diff --git a/pkgs/development/compilers/gcc-4.5/default.nix b/pkgs/development/compilers/gcc-4.5/default.nix index b3bd431fbc95..5f99ad89434c 100644 --- a/pkgs/development/compilers/gcc-4.5/default.nix +++ b/pkgs/development/compilers/gcc-4.5/default.nix @@ -147,13 +147,15 @@ stdenv.mkDerivation ({ postPatch = if (stdenv.system == "i586-pc-gnu" + || (libcCross != null) # e.g., building `gcc.hostDrv' || (cross != null && cross.config == "i586-pc-gnu" && libcCross != null)) then # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not # in glibc, so add the right `-I' flags to the default spec string. + assert libcCross != null -> libpthreadCross != null; let - libc = if cross != null then libcCross else stdenv.glibc; + libc = if libcCross != null then libcCross else stdenv.glibc; gnu_h = "gcc/config/gnu.h"; i386_gnu_h = "gcc/config/i386/gnu.h"; extraCPPDeps = @@ -186,7 +188,7 @@ stdenv.mkDerivation ({ # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. let - libc = if (cross != null && libcCross != null) then libcCross else stdenv.gcc.libc; + libc = if (libcCross != null) then libcCross else stdenv.gcc.libc; in '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..." for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a6aeee713df0..1b3f1b4b6721 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1847,6 +1847,16 @@ let # bootstrapping a profiled compiler does not work in the sheevaplug: # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43944 profiledCompiler = if stdenv.system == "armv5tel-linux" then false else true; + + # When building `gcc.hostDrv' (a "Canadian cross", with host == target + # and host != build), `cross' must be null but the cross-libc must still + # be passed. + cross = null; + libcCross = if crossSystem != null then libcCross else null; + libpthreadCross = + if crossSystem != null && crossSystem.config == "i586-pc-gnu" + then gnu.libpthreadCross + else null; })); gcc46_real = lowPrio (wrapGCC (callPackage ../development/compilers/gcc-4.6 {