summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Childs <lorne@cons.org.nz>2021-06-04 21:44:23 +0900
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2021-06-10 05:29:18 +0000
commitd5f98e83453939b77d3c93ae98344e7f2addfb75 (patch)
tree10a4d8f2853ecbf9088537ece11266627e6f1929
parentMerge pull request #126365 from NixOS/backport-126343-to-release-21.05 (diff)
downloadnixpkgs-origin/backport-125668-to-release-21.05.tar.gz
glibc: fix build vs host tool confusionorigin/backport-125668-to-release-21.05
Fixes cross compilation from aarch64-linux -> armv7l-linux (cherry picked from commit e57b58bd0e292c866f790475dd035ac3e2543dd1)
-rw-r--r--pkgs/development/libraries/glibc/common.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index 3597dd70f2c9..888548d79f03 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -226,6 +226,28 @@ stdenv.mkDerivation ({
libc_cv_c_cleanup=yes
libc_cv_gnu89_inline=yes
EOF
+
+ # ./configure has logic like
+ #
+ # AR=`$CC -print-prog-name=ar`
+ #
+ # This searches various directories in the gcc and its wrapper. In nixpkgs,
+ # this returns the bare string "ar", which is build ar. This can result as
+ # a build failure with the following message:
+ #
+ # libc_pic.a: error adding symbols: archive has no index; run ranlib to add one
+ #
+ # (Observed cross compiling from aarch64-linux -> armv7l-linux).
+ #
+ # Nixpkgs passes a correct value for AR and friends, so to use the correct
+ # set of tools, we only need to delete this special handling.
+ sed -i \
+ -e '/^AR=/d' \
+ -e '/^AS=/d' \
+ -e '/^LD=/d' \
+ -e '/^OBJCOPY=/d' \
+ -e '/^OBJDUMP=/d' \
+ $configureScript
'';
preBuild = lib.optionalString withGd "unset NIX_DONT_SET_RPATH";