diff --git a/pkgs/build-support/gcc-cross-wrapper/builder.sh b/pkgs/build-support/gcc-cross-wrapper/builder.sh index a3a4d01e3c4b..ef46cc110f2e 100644 --- a/pkgs/build-support/gcc-cross-wrapper/builder.sh +++ b/pkgs/build-support/gcc-cross-wrapper/builder.sh @@ -38,7 +38,10 @@ if test -n "$nativeTools"; then gccPath="$nativePrefix/bin" ldPath="$nativePrefix/bin" else - ldflags="$ldflags -L$gcc/lib" + if test -n "$gccLibs"; then + ldflags="$ldflags -L$gccLibs/lib -L$gccLibs/lib64" + fi + ldflags="$ldflags -L$gcc/lib -L$gcc/lib64" gccPath="$gcc/bin" ldPath="$binutils/$crossConfig/bin" fi diff --git a/pkgs/build-support/gcc-cross-wrapper/default.nix b/pkgs/build-support/gcc-cross-wrapper/default.nix index 362e378273dd..ea5e5d0dd564 100644 --- a/pkgs/build-support/gcc-cross-wrapper/default.nix +++ b/pkgs/build-support/gcc-cross-wrapper/default.nix @@ -13,6 +13,20 @@ assert nativeTools -> nativePrefix != ""; assert !nativeTools -> gcc != null && binutils != null; assert !noLibc -> (!nativeLibc -> libc != null); +let + chosenName = if name == "" then gcc.name else name; + gccLibs = stdenv.mkDerivation { + name = chosenName + "-libs"; + phases = [ "installPhase" ]; + installPhase = '' + ensureDir $out + cp -Rd ${gcc}/lib $out/lib + if [ -d ${gcc}/lib64 ]; then + cp -Rd ${gcc}/lib64 $out/lib64 + fi + ''; + }; +in stdenv.mkDerivation { builder = ./builder.sh; setupHook = ./setup-hook.sh; @@ -22,7 +36,8 @@ stdenv.mkDerivation { addFlags = ./add-flags; inherit nativeTools nativeLibc nativePrefix gcc libc binutils; crossConfig = if (cross != null) then cross.config else null; - name = if name == "" then gcc.name else name; + gccLibs = if gcc != null then gccLibs else null; + name = chosenName; langC = if nativeTools then true else gcc.langC; langCC = if nativeTools then true else gcc.langCC; langF77 = if nativeTools then false else gcc ? langFortran; diff --git a/pkgs/development/libraries/glibc-2.11/default.nix b/pkgs/development/libraries/glibc-2.11/default.nix index 7063008fe913..31a8ef13a4fe 100644 --- a/pkgs/development/libraries/glibc-2.11/default.nix +++ b/pkgs/development/libraries/glibc-2.11/default.nix @@ -74,5 +74,10 @@ in dontStrip=1 ''; - } + + # To avoid a dependency on the build system 'bash'. + preFixup = '' + rm $out/bin/{ldd,tzselect,catchsegv,xtrace} + ''; + } else {}))