diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh index c15fd1da9c03..b499aa612f8c 100644 --- a/pkgs/build-support/gcc-wrapper/builder.sh +++ b/pkgs/build-support/gcc-wrapper/builder.sh @@ -39,9 +39,9 @@ if test -n "$nativeTools"; then ldPath="$nativePrefix/bin" else if test -e "$gcc/lib64"; then - gccLDFlags="$gccLDFlags -L$gcc/lib64" + gccLDFlags="$gccLDFlags -L$gcc_lib/lib64" fi - gccLDFlags="$gccLDFlags -L$gcc/lib" + gccLDFlags="$gccLDFlags -L$gcc_lib/lib" if [ -n "$langVhdl" ]; then gccLDFlags="$gccLDFlags -L$zlib/lib" fi diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 82167cddf2e3..d4ba45b26f4a 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -40,6 +40,7 @@ stdenv.mkDerivation { addFlags = ./add-flags; inherit nativeTools nativeLibc nativePrefix gcc; + gcc_lib = gcc.lib or gcc; libc = if nativeLibc then null else libc; libc_dev = if nativeLibc then null else libc.dev or libc; libc_bin = if nativeLibc then null else libc.bin or libc; diff --git a/pkgs/development/compilers/gcc/4.6/builder.sh b/pkgs/development/compilers/gcc/4.6/builder.sh index 19dfb9c1bae6..e207b21f4a8c 100644 --- a/pkgs/development/compilers/gcc/4.6/builder.sh +++ b/pkgs/development/compilers/gcc/4.6/builder.sh @@ -8,9 +8,10 @@ mkdir $NIX_FIXINC_DUMMY if test "$staticCompiler" = "1"; then EXTRA_LDFLAGS="-static" else - EXTRA_LDFLAGS="" + EXTRA_LDFLAGS="-Wl,-rpath,$lib/lib" fi + # GCC interprets empty paths as ".", which we don't want. if test -z "$CPATH"; then unset CPATH; fi if test -z "$LIBRARY_PATH"; then unset LIBRARY_PATH; fi @@ -33,7 +34,7 @@ if test "$noSysDirs" = "1"; then # The path to the Glibc binaries such as `crti.o'. glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib" - + else # Hack: support impure environments. extraFlags="-isystem /usr/include" @@ -50,10 +51,10 @@ if test "$noSysDirs" = "1"; then # bootstrap compiler are optimized and (optionally) contain # debugging information (info "(gccinstall) Building"). if test -n "$dontStrip"; then - extraFlags="-O2 -g $extraFlags" + extraFlags="-O2 -g $extraFlags" else - # Don't pass `-g' at all; this saves space while building. - extraFlags="-O2 $extraFlags" + # Don't pass `-g' at all; this saves space while building. + extraFlags="-O2 $extraFlags" fi EXTRA_FLAGS="$extraFlags" @@ -205,6 +206,10 @@ preInstall() { postInstall() { + # Move runtime libraries to $lib. + mkdir -p $lib/lib + mv -v $out/lib/lib*.so $out/lib/lib*.so.*[0-9] $lib/lib/ + # Remove precompiled headers for now. They are very big and # probably not very useful yet. find $out/include -name "*.gch" -exec rm -rf {} \; -prune @@ -213,9 +218,10 @@ postInstall() { # previous gcc. rm -rf $out/libexec/gcc/*/*/install-tools rm -rf $out/lib/gcc/*/*/install-tools - + # More dependencies with the previous gcc or some libs (gccbug stores the build command line) rm -rf $out/bin/gccbug + # Take out the bootstrap-tools from the rpath, as it's not needed at all having $out for i in $out/libexec/gcc/*/*/*; do if PREV_RPATH=`patchelf --print-rpath $i`; then diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix index af6e9ab0ee19..476ddaa84091 100644 --- a/pkgs/development/compilers/gcc/4.6/default.nix +++ b/pkgs/development/compilers/gcc/4.6/default.nix @@ -192,6 +192,10 @@ stdenv.mkDerivation ({ inherit langC langCC langFortran langJava langAda langGo; }; + outputs = [ "out" "lib" ]; + + setOutputConfigureFlags = false; + inherit patches enableMultilib; libc_dev = stdenv.gcc.libc_dev; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index a20adb6aba2f..8714afa0358c 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -193,9 +193,9 @@ rec { stdenvLinuxGlibc = stdenvLinuxBoot2Pkgs.glibc; - # 6) Construct a third stdenv identical to the 2nd, except that - # this one uses the Glibc built in step 3. It still uses - # the recent binutils and rest of the bootstrap tools, including GCC. + # 6) Construct a third stdenv identical to the 2nd, except that this + # one uses the Glibc built in step 3. It still uses the recent + # binutils and the rest of the bootstrap tools, including GCC. stdenvLinuxBoot3 = stdenvBootFun { gcc = wrapGCC { binutils = stdenvLinuxBoot1Pkgs.binutils; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0bbb81745a46..1896bbcb1363 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2254,6 +2254,7 @@ let })); gcc46_real = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.6 { + stdenv = stdenvMulti; inherit noSysDirs; # bootstrapping a profiled compiler does not work in the sheevaplug: