Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails cross check --target x86_64-pc-solaris on 1.72.1 #2540

Closed
jtmoon79 opened this issue Nov 16, 2024 · 6 comments · Fixed by #2544
Closed

fails cross check --target x86_64-pc-solaris on 1.72.1 #2540

jtmoon79 opened this issue Nov 16, 2024 · 6 comments · Fixed by #2544

Comments

@jtmoon79
Copy link

jtmoon79 commented Nov 16, 2024

Cross-compiling nix 0.29.0 fails for platform x86_64-pc-solaris.

Running on Ubuntu 22, using rust 1.72.1

$ cross --version
cross 0.2.5
cargo 1.72.1 (103a7ff2e 2023-08-15)

$ cross check --locked --lib --bins --target x86_64-pc-solaris
...
   Compiling kinded_macros v0.3.0
error[E0425]: cannot find value `O_DIRECT` in crate `libc`
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.29.0/src/fcntl.rs:113:9
    |
113 |         O_DIRECT;
    |         ^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `SIGINFO` in crate `libc`
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.29.0/src/sys/signal.rs:119:9
     |
119  |         SIGINFO,
     |         ^^^^^^^
     |
    ::: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.164/src/unix/solarish/mod.rs:1285:1
     |
1285 | pub const SIGINT: ::c_int = 2;
     | ------------------------- similarly named constant `SIGINT` defined here
     |
help: a constant with a similar name exists
     |
119  |         SIGINT,
     |         ~~~~~~
help: consider importing this unit variant
     |
6    + use crate::sys::signal::Signal::SIGINFO;
     |

error[E0531]: cannot find unit struct, unit variant or constant `SIGINFO` in crate `libc`
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.29.0/src/sys/signal.rs:119:9
     |
119  |         SIGINFO,
     |         ^^^^^^^
     |
    ::: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.164/src/unix/solarish/mod.rs:1285:1
     |
1285 | pub const SIGINT: ::c_int = 2;
     | ------------------------- similarly named constant `SIGINT` defined here
     |
help: a constant with a similar name exists
     |
119  |         SIGINT,
     |         ~~~~~~
help: consider importing this unit variant
     |
6    + use crate::sys::signal::Signal::SIGINFO;
     |

    Checking hashbrown v0.14.2
error[E0081]: discriminant value `8` assigned more than once
   --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.29.0/src/macros.rs:131:9
    |
131 | /         $v enum $BitFlags {
132 | |             $($entries)*
133 | |         }
    | |_________^
...
255 |                   $entry = libc::$entry,
    |                            ------------
    |                            |
    |                            `8` assigned here
    |                            `8` assigned here
    |
   ::: /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.29.0/src/sys/signal.rs:28:1
    |
28  | / libc_enum! {
29  | |     /// Types of operating system signals
30  | |     // Currently there is only one definition of c_int in libc, as well as only one
31  | |     // type for signal constants.
...   |
121 | |     impl TryFrom<i32>
122 | | }
    | |_- in this macro invocation
    |
    = note: this error originates in the macro `libc_enum` (in Nightly build)

I found this by way of updating dependency tempfile from 3.13.0 to 3.14.0, which compiles kinded_macros 0.3.0, which compiles nix 0.29.0.

I have not tried other rust versions or platform configurations.

@jtmoon79
Copy link
Author

jtmoon79 commented Nov 16, 2024

Closing. I'm unable to reproduce this error when compiling only the nix project.

Updated instructions with corrected reproduction steps.

$ git clone https://github.com/nix-rust/nix.git
$ cd nix
$ rustup target add x86_64-pc-solaris
$ rustup override set 1.72.1
$ cross --version
cross 0.2.5
[cross] note: Falling back to `cargo` on the host.
cargo 1.72.1 (103a7ff2e 2023-08-15)
$ cross check --locked --lib --bins --target x86_64-pc-solaris --all-features

Currently at 0e4353a

Run on Ubuntu 22.04 x86_64 (WSL2).

@SteveLauC
Copy link
Member

I think the build failure is expected because O_DIRECT is indeed unavailable on that target, the reason why you cannot reproduce it with Nix is that Nix has feature-gates, without enabling any of them, you are building a tiny set of Nix, checking it with --all-features should give you the errors.

@SteveLauC SteveLauC reopened this Nov 17, 2024
@SteveLauC
Copy link
Member

SteveLauC commented Nov 17, 2024

The thing that makes me confused is your crate has already been using Nix 0.29.0 (tempfile does not use Nix so it should be unrelated), why didn't this build fail in the past? 🤔

@jtmoon79
Copy link
Author

checking it with --all-features should give you the errors.

Indeed, this caused the failure

$ cross check --locked --lib --bins --target x86_64-pc-solaris --all-features
[cross] warning: `cross` does not provide a Docker image for target x86_64-pc-solaris, specify a custom image in `Cross.toml`.
[cross] note: Falling back to `cargo` on the host.
   Compiling autocfg v1.4.0
   Compiling nix v0.29.0 (/home/jtmoon/Projects/nix)
    Checking pin-utils v0.1.0
   Compiling memoffset v0.9.1
error[E0425]: cannot find value `O_DIRECT` in crate `libc`
   --> src/fcntl.rs:147:9
    |
147 |         O_DIRECT;
    |         ^^^^^^^^ not found in `libc`

...

devnexen added a commit to devnexen/nix that referenced this issue Nov 18, 2024
@SteveLauC
Copy link
Member

I found this by way of updating dependency tempfile from 3.13.0 to 3.14.0, which compiles kinded_macros 0.3.0, which compiles nix 0.29.0.

Sorry for missing this info, but it looks like tempfile does not use kinded_macros

@SteveLauC SteveLauC linked a pull request Nov 20, 2024 that will close this issue
@jtmoon79
Copy link
Author

Related to #935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants