From b7ad38392464c018db87a4c9fa370a6a1e48c2ea Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Feb 2004 16:55:23 +0000 Subject: [PATCH] * Bah. All this time gcc was linking programs against /usr/lib/crt1.o, while it should be using $glibc/lib/crt1.o. This quick hack (prepending $glibc/lib to the GCC search path using "-B") fixes the problem, but a better solution to prevent this sort of thing is to remove these static paths from gcc. Note: this problem was found using the pure UML Nix environment (where we don't have /usr/lib). svn path=/nixpkgs/trunk/; revision=810 --- pkgs/stdenv/nix-linux/prehook-boot.sh | 6 +++++- pkgs/stdenv/nix-linux/prehook.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/nix-linux/prehook-boot.sh b/pkgs/stdenv/nix-linux/prehook-boot.sh index 780c5aa5653..27118dfe989 100644 --- a/pkgs/stdenv/nix-linux/prehook-boot.sh +++ b/pkgs/stdenv/nix-linux/prehook-boot.sh @@ -5,7 +5,11 @@ export NIX_CXX=/usr/bin/g++ export NIX_LD=/usr/bin/ld export NIX_CFLAGS_COMPILE="-isystem $param4/include $NIX_CFLAGS_COMPILE" -export NIX_CFLAGS_LINK="-L$param4/lib $NIX_CFLAGS_LINK" +# The "-B$param4/lib" is a quick hack to force gcc to link against the +# crt1.o from our own glibc, rather than the one in /usr/lib. The +# real solution is of course to prevent those paths from being used by +# gcc in the first place. +export NIX_CFLAGS_LINK="-B$param4/lib -L$param4/lib $NIX_CFLAGS_LINK" export NIX_LDFLAGS="-dynamic-linker $param4/lib/ld-linux.so.2 -rpath $param4/lib $NIX_LDFLAGS" export NIX_LIBC_INCLUDES="$param4/include" diff --git a/pkgs/stdenv/nix-linux/prehook.sh b/pkgs/stdenv/nix-linux/prehook.sh index cc38a9c174d..a632b119848 100644 --- a/pkgs/stdenv/nix-linux/prehook.sh +++ b/pkgs/stdenv/nix-linux/prehook.sh @@ -5,7 +5,11 @@ export NIX_CXX=$param2/bin/g++ export NIX_LD=$param3/bin/ld export NIX_CFLAGS_COMPILE="-isystem $param4/include $NIX_CFLAGS_COMPILE" -export NIX_CFLAGS_LINK="-L$param4/lib -L$param2/lib $NIX_CFLAGS_LINK" +# The "-B$param4/lib" is a quick hack to force gcc to link against the +# crt1.o from our own glibc, rather than the one in /usr/lib. The +# real solution is of course to prevent those paths from being used by +# gcc in the first place. +export NIX_CFLAGS_LINK="-B$param4/lib -L$param4/lib -L$param2/lib $NIX_CFLAGS_LINK" export NIX_LDFLAGS="-dynamic-linker $param4/lib/ld-linux.so.2 -rpath $param4/lib -rpath $param2/lib $NIX_LDFLAGS" export NIX_LIBC_INCLUDES="$param4/include"