summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/make-binary-wrapper
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-05-29 17:26:23 +0200
committerNaïm Favier <n@monade.li>2022-05-31 13:55:41 +0200
commiteef2c762ce19c8cf7172b319a7f4cd5555b5f289 (patch)
tree9e2697335364ef36570ad9192fea222e39c66861 /pkgs/build-support/setup-hooks/make-binary-wrapper
parent5db40e768d1447624235b27d7176726550eb353f (diff)
downloadnixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.tar
nixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.tar.gz
nixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.tar.bz2
nixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.tar.lz
nixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.tar.xz
nixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.tar.zst
nixpkgs-eef2c762ce19c8cf7172b319a7f4cd5555b5f289.zip
makeBinaryWrapper: fix cross-compilation and add test
Fixes https://github.com/NixOS/nixpkgs/issues/175045
Diffstat (limited to 'pkgs/build-support/setup-hooks/make-binary-wrapper')
-rw-r--r--pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
index 34bed3bb297..9f52a05f61c 100644
--- a/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
+++ b/pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
@@ -1,10 +1,11 @@
 { stdenv
+, targetPackages
 , lib
 , makeSetupHook
 , dieHook
 , writeShellScript
 , tests
-, cc ? stdenv.cc
+, cc ? targetPackages.stdenv.cc
 , sanitizers ? []
 }:
 
@@ -14,7 +15,7 @@ makeSetupHook {
     ++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) cc;
 
   substitutions = {
-    cc = "${cc}/bin/cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}";
+    cc = "${cc}/bin/${cc.targetPrefix}cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}";
 
     # Extract the function call used to create a binary wrapper from its embedded docstring
     passthru.extractCmd = writeShellScript "extract-binary-wrapper-cmd" ''