Open drakon64 opened 2 months ago
It looks like the --target x86_64-unknown-linux-musl
flag isn't being passed to rustc
autocfg
is being built with --target x86_64-unknown-linux-musl
and -C linker
correctly set:
rustc --crate-name autocfg src/lib.rs --out-dir target/lib -L dependency=target/deps --cap-lints allow -C opt-level=3 -C codegen-units=1 --remap-path-prefix=/build=/ --cfg feature="default" --target x86_64-unknown-linux-musl --edition 2015 -C linker=/nix/store/32p3r91f5xnd87zwz8ifyn0jp3a3vl5h-x86_64-unknown-linux-musl-gcc-wrapper-13.3.0/bin/x86_64-unknown-linux-musl-cc -C metadata=1ecf74a98c -C extra-filename=-1ecf74a98c --crate-type lib --color always
num-traits
, which depends on autocfg
, is not:
rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=1 --edition 2021 --cfg feature="i128" --cfg feature="std" --out-dir target/build/num-traits --emit=dep-info,link -L dependency=target/buildDeps --extern autocfg=/nix/store/4x0mlmcwg8140lf748vm9p90rfwlw7ss-rust_autocfg-1.3.0-x86_64-unknown-linux-musl-lib/lib/libautocfg-1ecf74a98c.rlib --cap-lints allow --color always
Almost exactly the same error as https://github.com/nix-community/crate2nix/issues/132#issuecomment-699683437
I am trying to compile a Rust project to
x86_64-unknown-linux-musl
from ax86_64-unknown-linux-gnu
host (NixOS 24.05).pkgs
is defined as follows:I call the Rust derivation:
Where
./nix/rust.nix
is:and
./rust-toolchain.toml
is:While some crates build fine, eventually the build will fail because an
x86_64-unknown-linux-gnu
autocfg
cannot be found despite the build targetingx86_64-unknown-linux-musl
. The Rust compiler even acknowledges that ax86_64-unknown-linux-musl
build exists. I can also replicate this issue when targetingaarch64-unknown-linux-musl
andaarch64-unknown-linux-gnu
.