You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then if we build the package with rustPlatform.buildRustPackage on a platform that matches a target then cargo will attempt to use that configuration for building, leading to errors like:
error: linker `aarch64-linux-gnu-gcc` not found
|
= note: No such file or directory (os error 2)
Compiling instant v0.1.10
error: could not compile `encoding_rs` due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
builder for '/nix/store/pqx5zpfzj6a90li969dqpw9q51zh6q6c-apkeep-0.6.0.drv' failed with exit code 101
error: build of '/nix/store/pqx5zpfzj6a90li969dqpw9q51zh6q6c-apkeep-0.6.0.drv' failed
Can we generalise this fix? Always delete .cargo/config.toml? Or delete the section that matches the host platform? Or change the way we invoke cargo to avoid --target when we're not cross compiling.
I've tested that deleting the linker configuration for a target fixes that target, and it does.
Instead of deleting .cargo/config.toml, would it be better to delete the linker configuration of each target? This way other configuration is still there.
I've tested that this script works to fix apkeep, and it does. It simply loads the configuration, removes linker configuration for each target and then saves it.
Describe the bug
If a package supports cross compilation upstream:
https://github.com/bvaisvil/zenith/blob/8f890291284870ea12e065ada0844100ad7aa7dc/.cargo/config
https://github.com/EFForg/apkeep/blob/0.6.0/.cargo/config.toml
then if we build the package with
rustPlatform.buildRustPackage
on a platform that matches a target then cargo will attempt to use that configuration for building, leading to errors like:https://github.com/NixOS/nixpkgs/pull/145452/checks?check_run_id=4174333214
This is because we always pass
--target
to it, regardless of whether it's cross compiling or not:nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh
Line 24 in 6d3f429
cargo assumes it is cross compiling when
--target
is passed: rust-lang/cargo#5754 (comment)The easiest fix is to delete the cross compilation configuration like in #107237.
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
Successful build.
Additional context
#107237
#88616
#145452
Notify maintainers
@retrry
Metadata
"aarch64-darwin"
Darwin 21.1.0, macOS 12.0.1
yes
no
nix-env (Nix) 2.3.16
"nixpkgs-21.11pre309670.253aecf69ed"
"darwin, nixpkgs"
/nix/var/nix/profiles/per-user/root/channels/nixpkgs
The text was updated successfully, but these errors were encountered: