-
-
Notifications
You must be signed in to change notification settings - Fork 15k
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
patchShebangs doesn't select correct /bin/sh for cross builds #21138
Comments
/participate. (I've stumbled across this too.) |
Is it safe to assume This problem overlaps with another, #21191, which is that crossDrvs clobber stdenv's binaries in the PATH. The best solution I can come up with is to manually include Or we could just make setup.sh smarter about importing /bin/ PATHs that contain elements of the stdenv, namely: |
NixOS/nix#1080 is essential to fix this without greatly complicating bootstrapping. |
@matthewbauer don't forget to close. :) |
This hopefully makes patchShebangs respect cross compilation. It introduces the concept of the HOST_PATH. Nothing is ever executed on it but instead used as a way to get the proper path using ‘command -v’. Needs more testing. /cc @Ericson2314 @dtzWill Fixes NixOS#33956 Fixes NixOS#21138 (Modified backport of f069423. See previous commit to understand the differences between this and the original.)
This hopefully makes patchShebangs respect cross compilation. It introduces the concept of the HOST_PATH. Nothing is ever executed on it but instead used as a way to get the proper path using ‘command -v’. Needs more testing. /cc @Ericson2314 @dtzWill Fixes NixOS#33956 Fixes NixOS#21138
This hopefully makes patchShebangs respect cross compilation. It introduces the concept of the HOST_PATH. Nothing is ever executed on it but instead used as a way to get the proper path using ‘command -v’. Needs more testing. /cc @Ericson2314 @dtzWill Fixes NixOS#33956 Fixes NixOS#21138
Addressed in #43833 |
Issue description
pkgs/build-support/setup-hooks/patch-shebangs.sh
usescommand -v
to determine the substitute for the shebang path. This selects the wrong path during cross-builds and results in x86_64 binaries getting pulled in as dependencies to cross-built binaries that can't possibly use them at runtime.I don't know if we can reliably pick the correct /bin/sh without it being in the PATH envvar. I presume patchShebangs works fine for binaries that don't overlap with stdenv's and are included in buildInputs.
Steps to reproduce
If you cross-build some packages to ARM platforms, patchShebangs runs in the fixup phase and run
head -n1 /nix/store/*-glibc-2.24-arm*-bin/bin/sotruss
, you'll see it points to the native /bin/sh rather than the cross one. I was considering a PR to just adddontPatchShebangs=true;
to the cross build of glibc, but figured it'd be better if the root issue were fixed instead.Technical details
The text was updated successfully, but these errors were encountered: