diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-10-11 21:36:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 23:36:56 +0200 |
commit | 7262026f0f4e4a5f3382e91b564fb27c1ec9dd9e (patch) | |
tree | cbdc34a82bca64a73ee978253fd4a14508f4832e | |
parent | b8d473b6d20c91a3f38e3a0ae7492635fc6ed898 (diff) |
rustPlatform.cargoSetupHook: fix platform check (#260068)
Cargo will never need to link for the target platform — that'd be for the package being built to do at runtime. Cargo should know about the build and host linkers. This fixes e.g. pkgsCross.musl64.fd from x86_64-linux. Fixes: 67a4f828b46c ("rust: hooks: fix cross compilation")
-rw-r--r-- | pkgs/build-support/rust/hooks/default.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix index c73ec30082dc8..205d085d3507c 100644 --- a/pkgs/build-support/rust/hooks/default.nix +++ b/pkgs/build-support/rust/hooks/default.nix @@ -67,9 +67,9 @@ cargoConfig = '' [target."${rust.toRustTarget stdenv.buildPlatform}"] "linker" = "${rust.envVars.ccForBuild}" - ${lib.optionalString (stdenv.hostPlatform.config != stdenv.targetPlatform.config) '' - [target."${rust.toRustTarget stdenv.targetPlatform}"] - "linker" = "${rust.envVars.ccForTarget}" + ${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' + [target."${rust.toRustTarget stdenv.hostPlatform}"] + "linker" = "${rust.envVars.ccForHost}" ''} "rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ] ''; |