summary refs log tree commit diff
path: root/pkgs/development/libraries/glibc
diff options
context:
space:
mode:
authorAndrew Childs <lorne@cons.org.nz>2021-06-04 21:44:23 +0900
committerAndrew Childs <lorne@cons.org.nz>2021-06-04 21:44:23 +0900
commite57b58bd0e292c866f790475dd035ac3e2543dd1 (patch)
treece561f466eb1eaf54a22b4e44d3c670d60b4d490 /pkgs/development/libraries/glibc
parent2e88b6f989d35e279b65c5c8831b1a3a667a56dc (diff)
downloadnixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.tar
nixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.tar.gz
nixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.tar.bz2
nixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.tar.lz
nixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.tar.xz
nixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.tar.zst
nixpkgs-e57b58bd0e292c866f790475dd035ac3e2543dd1.zip
glibc: fix build vs host tool confusion
Fixes cross compilation from aarch64-linux -> armv7l-linux
Diffstat (limited to 'pkgs/development/libraries/glibc')
-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 3597dd70f2c..888548d79f0 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";