diff --git a/pkgs/development/compilers/gcc-static-4.1/builder.sh b/pkgs/development/compilers/gcc-static-4.1/builder.sh index 5db46d81ffb..deed3d82e62 100644 --- a/pkgs/development/compilers/gcc-static-4.1/builder.sh +++ b/pkgs/development/compilers/gcc-static-4.1/builder.sh @@ -14,8 +14,7 @@ if test "$noSysDirs" = "1"; then # Figure out what extra flags to pass to the gcc compilers being # generated to make sure that they use our glibc. - if test -e $NIX_GCC/nix-support/orig-glibc; then - glibc=$(cat $NIX_GCC/nix-support/orig-glibc) + if test -n $glibc; then # Ugh. Copied from gcc-wrapper/builder.sh. We can't just # source in $NIX_GCC/nix-support/add-flags, since that would @@ -37,6 +36,10 @@ if test "$noSysDirs" = "1"; then echo "NIX_GLIBC_FLAGS_SET=1" > $hook export NIX_LD_WRAPPER_START_HOOK=$hook + # Use *real* header files, otherwise a limits.h is generated + # that does not include Glibc's limits.h (notably missing + # SSIZE_MAX, which breaks the build). + export NIX_FIXINC_DUMMY=$glibc/include fi export NIX_EXTRA_CFLAGS=$extraCFlags @@ -65,7 +68,7 @@ preConfigure() { export LDFLFAGS="-static" configureScript=../$sourceRoot/configure - configureFlags="--enable-languages=c" + configureFlags="--enable-languages=c --disable-libstdcxx-pch" } diff --git a/pkgs/development/compilers/gcc-static-4.1/default.nix b/pkgs/development/compilers/gcc-static-4.1/default.nix index dae40313cc9..3415caa799e 100644 --- a/pkgs/development/compilers/gcc-static-4.1/default.nix +++ b/pkgs/development/compilers/gcc-static-4.1/default.nix @@ -1,6 +1,7 @@ { stdenv, fetchurl , langC ? true, langCC ? true, langF77 ? false , profiledCompiler ? false +, glibc }: assert langC; @@ -12,7 +13,7 @@ stdenv.mkDerivation { url = http://nix.cs.uu.nl/dist/tarballs/gcc-4.1.1.tar.bz2; md5 = "ad9f97a4d04982ccf4fd67cb464879f3"; }; - patches = [./no-sys-dirs.patch]; - inherit langC langCC langF77 profiledCompiler; + patches = [./pass-cxxcpp.patch ./no-sys-dirs.patch]; + inherit langC langCC langF77 profiledCompiler glibc; noSysDirs = 1; } diff --git a/pkgs/development/compilers/gcc-static-4.1/pass-cxxcpp.patch b/pkgs/development/compilers/gcc-static-4.1/pass-cxxcpp.patch index 4f9a29ae51b..9b0676d4fdc 100644 --- a/pkgs/development/compilers/gcc-static-4.1/pass-cxxcpp.patch +++ b/pkgs/development/compilers/gcc-static-4.1/pass-cxxcpp.patch @@ -14,7 +14,7 @@ diff -rc gcc-orig/Makefile.in gcc-4.1.1/Makefile.in RAW_CXX_TARGET_EXPORTS = \ $(BASE_TARGET_EXPORTS) \ CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ -! CXX="$(RAW_CXX_FOR_TARGET)"; export CXX; \ +! CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD)"; export CXX; \ ! CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD) -E"; export CXXCPP; NORMAL_TARGET_EXPORTS = \ diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 4ed60b06c83..93e33ff87c0 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -23,7 +23,7 @@ let binutils = pkgsDiet.binutils217; gcc = import ../../development/compilers/gcc-static-4.1 { - inherit (pkgs) fetchurl stdenv; + inherit (pkgs) fetchurl stdenv glibc; profiledCompiler = false; langCC = false; };