From 6980e6b35aacccd4e75a76a384f9dec30f31fa55 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 28 Jun 2023 23:49:38 -0700 Subject: [PATCH 1/6] lib.systems: introduce hasSharedLibraries This commit adds `hasSharedLibraries` to `lib.systems`. We need `plat.hasSharedLibraries` in order to know whether or not to expect `gcc` (and many other tools) to emit shared libraries (like `libgcc_s.so`). Many of the GNU build scripts are smart enough that if you configure them with `--enable-shared` on a platform (such as `arm-none-eabi`) that doesn't support dynamic linking, they will simply skip the shared libraries instead of aborting the `configurePhase`. Unfortunately the missing shared libraries in the final build product cause very hard-to-troubleshoot problems later on. The alternative to introducing `hasSharedLibraries` would be to set `isStatic` in these situations. However doing so causes `make-derivation.nix` to insert `-static` between the `pname` and `hostPlatform` suffix, which is undesirable. If at some point in the future we eliminate the `-static` suffix, then `hasSharedLibraries` can be made equal to `!isStatic`. --- lib/systems/default.nix | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 78ccd50ba79a..a3462d2d424b 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -86,7 +86,7 @@ rec { # choice. else "bfd"; extensions = rec { - sharedLibrary = + sharedLibrary = assert final.hasSharedLibraries; /**/ if final.isDarwin then ".dylib" else if final.isWindows then ".dll" else ".so"; @@ -132,6 +132,25 @@ rec { # uname -r release = null; }; + + # It is important that hasSharedLibraries==false when the platform has no + # dynamic library loader. Various tools (including the gcc build system) + # have knowledge of which platforms are incapable of dynamic linking, and + # will still build on/for those platforms with --enable-shared, but simply + # omit any `.so` build products such as libgcc_s.so. When that happens, + # it causes hard-to-troubleshoot build failures. + hasSharedLibraries = with final; + (isAndroid || isGnu || isMusl # Linux (allows multiple libcs) + || isDarwin || isSunOS || isOpenBSD || isFreeBSD || isNetBSD # BSDs + || isCygwin || isMinGW # Windows + ) && !isStatic; + + # The difference between `isStatic` and `hasSharedLibraries` is mainly the + # addition of the `staticMarker` (see make-derivation.nix). Some + # platforms, like embedded machines without a libc (e.g. arm-none-eabi) + # don't support dynamic linking, but don't get the `staticMarker`. + # `pkgsStatic` sets `isStatic=true`, so `pkgsStatic.hostPlatform` always + # has the `staticMarker`. isStatic = final.isWasm || final.isRedox; # Just a guess, based on `system` From e41f217257cf34d1328cad141cfb01c6f8093b37 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 28 Jun 2023 23:59:59 -0700 Subject: [PATCH 2/6] gcc: use hasSharedLibraries instead of isStatic --- pkgs/development/compilers/gcc/10/default.nix | 6 +++--- pkgs/development/compilers/gcc/11/default.nix | 6 +++--- pkgs/development/compilers/gcc/12/default.nix | 6 +++--- pkgs/development/compilers/gcc/13/default.nix | 6 +++--- pkgs/development/compilers/gcc/4.8/default.nix | 6 +++--- pkgs/development/compilers/gcc/4.9/default.nix | 6 +++--- pkgs/development/compilers/gcc/6/default.nix | 6 +++--- pkgs/development/compilers/gcc/7/default.nix | 6 +++--- pkgs/development/compilers/gcc/8/default.nix | 6 +++--- pkgs/development/compilers/gcc/9/default.nix | 6 +++--- pkgs/development/compilers/gcc/common/libgcc.nix | 3 +++ 11 files changed, 33 insertions(+), 30 deletions(-) diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index c1f6f061f8cd..d38429899372 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -9,8 +9,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -295,5 +295,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index 47662d5002c4..14073c6a05bc 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -9,8 +9,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -307,6 +307,6 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index e3ad55ae90ca..be3fde0649e1 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -9,8 +9,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -353,7 +353,7 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/13/default.nix b/pkgs/development/compilers/gcc/13/default.nix index b6f83f2662bf..c1834ead11ee 100644 --- a/pkgs/development/compilers/gcc/13/default.nix +++ b/pkgs/development/compilers/gcc/13/default.nix @@ -9,8 +9,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -347,7 +347,7 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 27fa2160c129..36359b213c78 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -8,8 +8,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man); required for Java , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -323,5 +323,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 2477f53b9caa..d708d0d44244 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -8,8 +8,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man); required for Java , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -350,5 +350,5 @@ lib.pipe (stdenv.mkDerivation ({ '';} )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 61874359b2a3..ba8bcf5342a3 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -9,8 +9,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , flex , perl ? null # optional, for texi2pod (then pod2man); required for Java @@ -368,5 +368,5 @@ lib.pipe (stdenv.mkDerivation ({ '';} )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 19010a578ac4..a93d3c491b58 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -7,8 +7,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -302,5 +302,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index f06b60ba6df6..1f913fe57d35 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -7,8 +7,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -277,5 +277,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index d022349c73a1..79ca57e2f72c 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -9,8 +9,8 @@ , profiledCompiler ? false , langJit ? false , staticCompiler ? false -, enableShared ? !stdenv.targetPlatform.isStatic -, enableLTO ? !stdenv.hostPlatform.isStatic +, enableShared ? stdenv.targetPlatform.hasSharedLibraries +, enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) , gmp, mpfr, libmpc, gettext, which, patchelf, binutils @@ -292,5 +292,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } ) ) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) ] diff --git a/pkgs/development/compilers/gcc/common/libgcc.nix b/pkgs/development/compilers/gcc/common/libgcc.nix index 2477a6811aa1..29ec421555ed 100644 --- a/pkgs/development/compilers/gcc/common/libgcc.nix +++ b/pkgs/development/compilers/gcc/common/libgcc.nix @@ -7,8 +7,11 @@ , targetPlatform , hostPlatform , crossStageStatic +, enableShared }: +assert !stdenv.targetPlatform.hasSharedLibraries -> !enableShared; + drv: lib.pipe drv ([ From 2affd455a40a28825f356307ce5bd8fa2f202217 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 16 Jun 2023 14:15:36 -0700 Subject: [PATCH 3/6] gccCrossStageStatic: enable dynamic libraries, rename to gccWithoutTargetLibc This commit allows `gccCrossStageStatic` to build dynamically-linked libraries. Since is no longer restricted to building static libraries its name is no longer appropriate, and this commit also renames it to the more-accurate `gccWithoutTargetLibc`. By default, you can't build a gcc that knows how to create dynamic libraries unless you have already built the targetPlatform libc. Because of this, our gcc cross-compiler is built in two stages: 1. Build a cross-compiler (gccCrossStageStatic) that can build only static libraries. 2. Use gccCrossStageStatic to compile the targetPlatform libc. 3. Use the targetPlatform libc to build a fully-capable cross compiler. You might notice that this pattern looks very similar to what we do with `xgcc` in the stdenv bootstrap. Indeed it is! I would like to work towards getting the existing stdenv bootstrap to handle cross compilers as well. However we don't want to cripple `stdenv.xgcc` by taking away its ability to build dynamic libraries. It turns out that the only thing gcc needs the targetPlatform libc for is to emit a DT_NEEDED for `-lc` into `libgcc.so`. That's it! And since we don't use `gccCrossStageStatic` to build anything other than libc, it's safe to omit the `DT_NEEDED` because that `libgcc` will never be loaded by anything other than `libc`. So `libc` will already be in the process's address space. Other people have noticed this; crosstool-ng has been using this approach for a very long time: https://github.com/crosstool-ng/crosstool-ng/blob/36ad0b17a732aaffe4701d5d8d410d6e3e3abba9/scripts/build/cc/gcc.sh#L638-L640 --- .../compilers/gcc/common/configure-flags.nix | 1 - .../compilers/gcc/common/pre-configure.nix | 18 ++++++++++++++++-- pkgs/os-specific/windows/default.nix | 2 +- pkgs/top-level/all-packages.nix | 7 +++---- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index aa8ecc62e55a..ae4ef6bddf67 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -66,7 +66,6 @@ let "--disable-threads" "--disable-libgomp" "--disable-libquadmath" - "--disable-shared" "--disable-libatomic" # requires libc "--disable-decimal-float" # requires libc "--disable-libmpx" # requires libc diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix index 58e44b96b5d3..bfdab20df1a2 100644 --- a/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -1,10 +1,13 @@ -{ lib, version, buildPlatform, hostPlatform, targetPlatform +{ lib +, stdenv +, version, buildPlatform, hostPlatform, targetPlatform , gnat-bootstrap ? null , langAda ? false , langJava ? false , langJit ? false , langGo -, crossStageStatic +, withoutTargetLibc +, enableShared , enableMultilib }: @@ -109,6 +112,17 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' export inhibit_libc=true '' +# Trick to build a gcc that is capable of emitting shared libraries *without* having the +# targetPlatform libc available beforehand. Taken from: +# https://web.archive.org/web/20170222224855/http://frank.harvard.edu/~coldwell/toolchain/ +# https://web.archive.org/web/20170224235700/http://frank.harvard.edu/~coldwell/toolchain/t-linux.diff ++ lib.optionalString (targetPlatform != hostPlatform && withoutTargetLibc && enableShared) + (lib.optionalString (!stdenv.targetPlatform.isPower) '' + echo 'libgcc.a: crti.o crtn.o' >> libgcc/Makefile.in + '' + '' + echo 'SHLIB_LC=' >> libgcc/Makefile.in + '') + + lib.optionalString (!enableMultilib && hostPlatform.is64bit && !hostPlatform.isMips64n32) '' export linkLib64toLib=1 '' diff --git a/pkgs/os-specific/windows/default.nix b/pkgs/os-specific/windows/default.nix index 8d6dd50548e5..12859de8a20f 100644 --- a/pkgs/os-specific/windows/default.nix +++ b/pkgs/os-specific/windows/default.nix @@ -20,7 +20,7 @@ lib.makeScope newScope (self: with self; { crossThreadsStdenv = overrideCC crossLibcStdenv (if stdenv.hostPlatform.useLLVM or false then buildPackages.llvmPackages_8.clangNoLibcxx - else buildPackages.gccCrossStageStatic.override (old: { + else buildPackages.gccWithoutTargetLibc.override (old: { bintools = old.bintools.override { libc = libcCross; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index faa09a9732f4..ff0b9db18e3a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14346,7 +14346,7 @@ with pkgs; xbursttools = callPackage ../tools/misc/xburst-tools { # It needs a cross compiler for mipsel to build the firmware it will # load into the Ben Nanonote - gccCross = pkgsCross.ben-nanonote.buildPackages.gccCrossStageStatic; + gccCross = pkgsCross.ben-nanonote.buildPackages.gccWithoutTargetLibc; autoconf = buildPackages.autoconf269; }; @@ -15266,7 +15266,7 @@ with pkgs; dontStrip = true; }))); - gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccCrossStageStatic; + gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccWithoutTargetLibc; crossLibcStdenv = if stdenv.hostPlatform.useLLVM or false || stdenv.hostPlatform.isDarwin @@ -15275,7 +15275,7 @@ with pkgs; # The GCC used to build libc for the target platform. Normal gccs will be # built with, and use, that cross-compiled libc. - gccCrossStageStatic = assert stdenv.targetPlatform != stdenv.hostPlatform; let + gccWithoutTargetLibc = assert stdenv.targetPlatform != stdenv.hostPlatform; let libcCross1 = binutilsNoLibc.libc; in wrapCCWith { cc = gccFun { @@ -15292,7 +15292,6 @@ with pkgs; langCC = false; libcCross = libcCross1; targetPackages.stdenv.cc.bintools = binutilsNoLibc; - enableShared = false; }; bintools = binutilsNoLibc; libc = libcCross1; From 443dfc4b05360794aa0304459177557107274559 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 16 Jun 2023 14:45:50 -0700 Subject: [PATCH 4/6] gcc: s_crossStageStatic_withoutTargetLibc_ This commit renames the `crossStageStatic` argument to the `gcc` expression to `withoutTargetLibc`. See previous commit for details. --- pkgs/development/compilers/gcc/10/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/11/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/12/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/13/default.nix | 10 +++++----- pkgs/development/compilers/gcc/4.8/default.nix | 10 +++++----- pkgs/development/compilers/gcc/4.9/default.nix | 10 +++++----- pkgs/development/compilers/gcc/6/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/7/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/8/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/9/default.nix | 12 ++++++------ pkgs/development/compilers/gcc/builder.sh | 4 ++-- .../compilers/gcc/common/configure-flags.nix | 6 +++--- .../compilers/gcc/common/dependencies.nix | 4 ++-- .../compilers/gcc/common/extra-target-flags.nix | 10 +++++----- pkgs/development/compilers/gcc/common/libgcc.nix | 5 ++--- .../compilers/gcc/common/pre-configure.nix | 2 +- pkgs/top-level/all-packages.nix | 3 +-- 17 files changed, 73 insertions(+), 75 deletions(-) diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index d38429899372..9f49cc2b91f5 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -22,7 +22,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -69,7 +69,7 @@ let majorVersion = "10"; ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch ++ optional (buildPlatform.system == "aarch64-darwin" && targetPlatform != buildPlatform) (fetchpatch { url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch"; @@ -78,7 +78,7 @@ let majorVersion = "10"; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -99,7 +99,7 @@ let majorVersion = "10"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -214,7 +214,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -295,5 +295,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index 14073c6a05bc..c64fd0853f9a 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -22,7 +22,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -82,14 +82,14 @@ let majorVersion = "11"; ++ optional (stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch # openjdk build fails without this on -march=opteron; is upstream in gcc12 ++ [ ./gcc-issue-103910.patch ]; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -110,7 +110,7 @@ let majorVersion = "11"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -227,7 +227,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -307,6 +307,6 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index be3fde0649e1..bb48446c8477 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -23,7 +23,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -127,11 +127,11 @@ let majorVersion = "12"; ++ optional (stdenv.isDarwin && langAda) ../gnat-darwin-dylib-install-name.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch; + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -152,7 +152,7 @@ let majorVersion = "12"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc disableBootstrap disableGdbPlugin enableLTO @@ -271,7 +271,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; @@ -353,7 +353,7 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/13/default.nix b/pkgs/development/compilers/gcc/13/default.nix index c1834ead11ee..19bb07669e5c 100644 --- a/pkgs/development/compilers/gcc/13/default.nix +++ b/pkgs/development/compilers/gcc/13/default.nix @@ -23,7 +23,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -125,7 +125,7 @@ let majorVersion = "13"; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -146,7 +146,7 @@ let majorVersion = "13"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc disableBootstrap disableGdbPlugin enableLTO @@ -265,7 +265,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; @@ -347,7 +347,7 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 36359b213c78..6a40bd753a3b 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -26,7 +26,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , buildPackages , callPackage @@ -109,7 +109,7 @@ let majorVersion = "4"; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -135,7 +135,7 @@ let majorVersion = "4"; boehmgc buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -232,7 +232,7 @@ lib.pipe (stdenv.mkDerivation ({ '' else null; - inherit noSysDirs staticCompiler langJava crossStageStatic + inherit noSysDirs staticCompiler langJava withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -323,5 +323,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index d708d0d44244..41df57ffd4c1 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -26,7 +26,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , buildPackages , callPackage @@ -126,7 +126,7 @@ let majorVersion = "4"; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -152,7 +152,7 @@ let majorVersion = "4"; boehmgc buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -253,7 +253,7 @@ lib.pipe (stdenv.mkDerivation ({ '' else null; - inherit noSysDirs staticCompiler langJava crossStageStatic + inherit noSysDirs staticCompiler langJava withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -350,5 +350,5 @@ lib.pipe (stdenv.mkDerivation ({ '';} )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index ba8bcf5342a3..1c1f4ae6cb31 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -29,7 +29,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -78,7 +78,7 @@ let majorVersion = "6"; ++ optional langGo ./gogcc-workaround-glibc-2.36.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch ++ optional (targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch { url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb"; sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2"; @@ -111,7 +111,7 @@ let majorVersion = "6"; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -137,7 +137,7 @@ let majorVersion = "6"; boehmgc buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -269,7 +269,7 @@ lib.pipe (stdenv.mkDerivation ({ )) ); - inherit noSysDirs staticCompiler langJava crossStageStatic + inherit noSysDirs staticCompiler langJava withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -368,5 +368,5 @@ lib.pipe (stdenv.mkDerivation ({ '';} )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index a93d3c491b58..de6ccbb2efd8 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -19,7 +19,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -81,13 +81,13 @@ let majorVersion = "7"; ++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -108,7 +108,7 @@ let majorVersion = "7"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -218,7 +218,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -302,5 +302,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 1f913fe57d35..da4b17910080 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -19,7 +19,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -63,12 +63,12 @@ let majorVersion = "8"; ++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch ++ [ ../libsanitizer-no-cyclades-9.patch ]; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -89,7 +89,7 @@ let majorVersion = "8"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -199,7 +199,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -277,5 +277,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 79ca57e2f72c..2d4e8a7524a8 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -22,7 +22,7 @@ , name ? "gcc" , libcCross ? null , threadsCross ? null # for MinGW -, crossStageStatic ? false +, withoutTargetLibc ? false , gnused ? null , cloog # unused; just for compat with gcc4, as we override the parameter on some places , buildPackages @@ -74,12 +74,12 @@ let majorVersion = "9"; ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch # Obtain latest patch with ../update-mcfgthread-patches.sh - ++ optional (!crossStageStatic && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch + ++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch ; /* Cross-gcc settings (build == host != target) */ crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt"; - stageNameAddon = if crossStageStatic then "stage-static" else "stage-final"; + stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final"; crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-"; callFile = lib.callPackageWith { @@ -100,7 +100,7 @@ let majorVersion = "9"; binutils buildPackages cloog - crossStageStatic + withoutTargetLibc enableLTO enableMultilib enablePlugin @@ -213,7 +213,7 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler crossStageStatic + inherit noSysDirs staticCompiler withoutTargetLibc libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) @@ -292,5 +292,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } ) ) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform enableShared crossStageStatic; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) ] diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index 5147df1e4cc0..892dbb565b8d 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -135,7 +135,7 @@ if test "$noSysDirs" = "1"; then ) fi - if test "$crossStageStatic" == 1; then + if test "$withoutTargetLibc" == 1; then # We don't want the gcc build to assume there will be a libc providing # limits.h in this stage makeFlagsArray+=( @@ -167,7 +167,7 @@ preConfigure() { rm -Rf zlib fi - if test -n "$crossMingw" -a -n "$crossStageStatic"; then + if test -n "$crossMingw" -a -n "$withoutTargetLibc"; then mkdir -p ../mingw # --with-build-sysroot expects that: cp -R $libcCross/include ../mingw diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index ae4ef6bddf67..f395f9e0960e 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -1,7 +1,7 @@ { lib, stdenv , targetPackages -, crossStageStatic, libcCross +, withoutTargetLibc, libcCross , threadsCross , version @@ -59,7 +59,7 @@ let "--with-as=${if targetPackages.stdenv.cc.bintools.isLLVM then binutils else targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as" "--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] - ++ (if crossStageStatic then [ + ++ (if withoutTargetLibc then [ "--disable-libssp" "--disable-nls" "--without-headers" @@ -111,7 +111,7 @@ let "--with-mpfr-lib=${mpfr.out}/lib" "--with-mpc=${libmpc}" ] - ++ lib.optionals (!crossStageStatic) [ + ++ lib.optionals (!withoutTargetLibc) [ (if libcCross == null then "--with-native-system-header-dir=${lib.getDev stdenv.cc.libc}/include" else "--with-native-system-header-dir=${lib.getDev libcCross}${libcCross.incdir or "/include"}") diff --git a/pkgs/development/compilers/gcc/common/dependencies.nix b/pkgs/development/compilers/gcc/common/dependencies.nix index 72aa0defcc6f..a38cdcb9e20f 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -30,7 +30,7 @@ , javaAwtGtk ? false , langAda ? false , langGo ? false -, crossStageStatic ? null +, withoutTargetLibc ? null , threadsCross ? null }: @@ -88,5 +88,5 @@ in ; # threadsCross.package after gcc6 so i assume its okay for 4.8 and 4.9 too - depsTargetTarget = optionals (!crossStageStatic && threadsCross != { } && threadsCross.package != null) [ threadsCross.package ]; + depsTargetTarget = optionals (!withoutTargetLibc && threadsCross != { } && threadsCross.package != null) [ threadsCross.package ]; } diff --git a/pkgs/development/compilers/gcc/common/extra-target-flags.nix b/pkgs/development/compilers/gcc/common/extra-target-flags.nix index 4dedd333b002..30a24185e3b4 100644 --- a/pkgs/development/compilers/gcc/common/extra-target-flags.nix +++ b/pkgs/development/compilers/gcc/common/extra-target-flags.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, crossStageStatic, langD ? false, libcCross, threadsCross }: +{ lib, stdenv, withoutTargetLibc, langD ? false, libcCross, threadsCross }: let inherit (stdenv) hostPlatform targetPlatform; @@ -11,23 +11,23 @@ in EXTRA_FLAGS_FOR_TARGET = let mkFlags = dep: langD: lib.optionals (targetPlatform != hostPlatform && dep != null && !langD) ([ "-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}" - ] ++ lib.optionals (! crossStageStatic) [ + ] ++ lib.optionals (! withoutTargetLibc) [ "-B${lib.getLib dep}${dep.libdir or "/lib"}" ]); in mkFlags libcCross langD - ++ lib.optionals (!crossStageStatic) (mkFlags (threadsCross.package or null) langD) + ++ lib.optionals (!withoutTargetLibc) (mkFlags (threadsCross.package or null) langD) ; EXTRA_LDFLAGS_FOR_TARGET = let mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([ "-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}" - ] ++ (if crossStageStatic then [ + ] ++ (if withoutTargetLibc then [ "-B${lib.getLib dep}${dep.libdir or "/lib"}" ] else [ "-Wl,-rpath,${lib.getLib dep}${dep.libdir or "/lib"}" "-Wl,-rpath-link,${lib.getLib dep}${dep.libdir or "/lib"}" ])); in mkFlags libcCross - ++ lib.optionals (!crossStageStatic) (mkFlags (threadsCross.package or null)) + ++ lib.optionals (!withoutTargetLibc) (mkFlags (threadsCross.package or null)) ; } diff --git a/pkgs/development/compilers/gcc/common/libgcc.nix b/pkgs/development/compilers/gcc/common/libgcc.nix index 29ec421555ed..19def2cbc4e6 100644 --- a/pkgs/development/compilers/gcc/common/libgcc.nix +++ b/pkgs/development/compilers/gcc/common/libgcc.nix @@ -6,8 +6,7 @@ , langJit , targetPlatform , hostPlatform -, crossStageStatic -, enableShared +, withoutTargetLibc }: assert !stdenv.targetPlatform.hasSharedLibraries -> !enableShared; @@ -20,7 +19,7 @@ drv: lib.pipe drv lib.optionalAttrs ( targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && - crossStageStatic + withoutTargetLibc ) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; installTargets = "install-gcc install-target-libgcc"; diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix index bfdab20df1a2..2561246a66f9 100644 --- a/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -108,7 +108,7 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' # gcc->clang "cross"-compilation manages to evade it: there # hostPlatform != targetPlatform, hostPlatform.config == targetPlatform.config. # We explicitly inhibit libc headers use in this case as well. -+ lib.optionalString (targetPlatform != hostPlatform && crossStageStatic) '' ++ lib.optionalString (targetPlatform != hostPlatform && withoutTargetLibc) '' export inhibit_libc=true '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ff0b9db18e3a..f617ac74bdb7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15287,8 +15287,7 @@ with pkgs; isl = if !stdenv.isDarwin then isl_0_20 else null; - # just for stage static - crossStageStatic = true; + withoutTargetLibc = true; langCC = false; libcCross = libcCross1; targetPackages.stdenv.cc.bintools = binutilsNoLibc; From 63305d00d32e8c743e36155a7d8cd544dc676d5b Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Tue, 27 Jun 2023 18:43:42 -0700 Subject: [PATCH 5/6] gcc: withoutTargetLibc: build libgcc_s.so We want a `libgcc_s.so` to be built by the first stage cross-compiler (withoutTargetLibc), since that is the compiler which will compile the target libc. This commit accomplishes that, by making three changes: 1. Replacing the `targetPlatform.libc == "msvcrt" &&` conditional with `enableShared`, so that the code which cross-build `libgcc_s.so` is used for all cross compilers capable of emitting shared libraries. 2. Removing the `targetPlatform == hostPlatform` guard from the code which produces the `libgcc` output. 3. Looking for build products in in "lib/${targetPlatform.config}/" rather than "lib/", so we will find them when cross compiling. --- pkgs/development/compilers/gcc/10/default.nix | 2 +- pkgs/development/compilers/gcc/11/default.nix | 2 +- pkgs/development/compilers/gcc/12/default.nix | 2 +- pkgs/development/compilers/gcc/13/default.nix | 2 +- .../development/compilers/gcc/4.8/default.nix | 2 +- .../development/compilers/gcc/4.9/default.nix | 2 +- pkgs/development/compilers/gcc/6/default.nix | 2 +- pkgs/development/compilers/gcc/7/default.nix | 2 +- pkgs/development/compilers/gcc/8/default.nix | 2 +- pkgs/development/compilers/gcc/9/default.nix | 2 +- .../compilers/gcc/common/configure-flags.nix | 1 + .../compilers/gcc/common/libgcc.nix | 23 +++++++++++++------ 12 files changed, 27 insertions(+), 17 deletions(-) diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 9f49cc2b91f5..c61093c67c03 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -295,5 +295,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index c64fd0853f9a..f61e51e2cabe 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -307,6 +307,6 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index bb48446c8477..9665c2a9fe85 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -353,7 +353,7 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/13/default.nix b/pkgs/development/compilers/gcc/13/default.nix index 19bb07669e5c..1b73c251ce6f 100644 --- a/pkgs/development/compilers/gcc/13/default.nix +++ b/pkgs/development/compilers/gcc/13/default.nix @@ -347,7 +347,7 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) (callPackage ../common/checksum.nix { inherit langC langCC; }) ] diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 6a40bd753a3b..fa856eff96e5 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -323,5 +323,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 41df57ffd4c1..bab79f968db3 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -350,5 +350,5 @@ lib.pipe (stdenv.mkDerivation ({ '';} )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 1c1f4ae6cb31..f443babb4b70 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -368,5 +368,5 @@ lib.pipe (stdenv.mkDerivation ({ '';} )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index de6ccbb2efd8..5b6ea7ead50a 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -302,5 +302,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index da4b17910080..f903e264b0af 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -277,5 +277,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } )) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 2d4e8a7524a8..289212a13635 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -292,5 +292,5 @@ lib.pipe (stdenv.mkDerivation ({ // optionalAttrs (enableMultilib) { dontMoveLib64 = true; } ) ) [ - (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc; }) + (callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; }) ] diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index f395f9e0960e..a60a3380ea25 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -66,6 +66,7 @@ let "--disable-threads" "--disable-libgomp" "--disable-libquadmath" + (lib.enableFeature enableShared "shared") "--disable-libatomic" # requires libc "--disable-decimal-float" # requires libc "--disable-libmpx" # requires libc diff --git a/pkgs/development/compilers/gcc/common/libgcc.nix b/pkgs/development/compilers/gcc/common/libgcc.nix index 19def2cbc4e6..528d9d7d13ac 100644 --- a/pkgs/development/compilers/gcc/common/libgcc.nix +++ b/pkgs/development/compilers/gcc/common/libgcc.nix @@ -4,6 +4,7 @@ , langC , langCC , langJit +, enableShared , targetPlatform , hostPlatform , withoutTargetLibc @@ -18,7 +19,7 @@ drv: lib.pipe drv (pkg: pkg.overrideAttrs (previousAttrs: lib.optionalAttrs ( targetPlatform != hostPlatform && - targetPlatform.libc == "msvcrt" && + enableShared && withoutTargetLibc ) { makeFlags = [ "all-gcc" "all-target-libgcc" ]; @@ -33,11 +34,15 @@ drv: lib.pipe drv lib.optional (lib.versionAtLeast version "11.0") (let + targetPlatformSlash = + if hostPlatform.config == targetPlatform.config + then "" + else "${targetPlatform.config}/"; + enableLibGccOutput = - (with stdenv; targetPlatform == hostPlatform) && !langJit && !stdenv.hostPlatform.isDarwin && - !stdenv.hostPlatform.isStatic + enableShared ; in @@ -52,6 +57,10 @@ in lib.optionalString (!langC) '' rm -f $out/lib/libgcc_s.so* '' + + lib.optionalString (hostPlatform.config != targetPlatform.config) '' + mkdir -p $lib/lib/ + ln -s ${targetPlatformSlash}lib $lib/lib + '' # TODO(amjoseph): remove the `libgcc_s.so` symlinks below and replace them # with a `-L${gccForLibs.libgcc}/lib` in cc-wrapper's @@ -64,10 +73,10 @@ in + lib.optionalString enableLibGccOutput ('' # move libgcc from lib to its own output (libgcc) mkdir -p $libgcc/lib - mv $lib/lib/libgcc_s.so $libgcc/lib/ - mv $lib/lib/libgcc_s.so.1 $libgcc/lib/ - ln -s $libgcc/lib/libgcc_s.so $lib/lib/ - ln -s $libgcc/lib/libgcc_s.so.1 $lib/lib/ + mv $lib/${targetPlatformSlash}lib/libgcc_s.so $libgcc/lib/ + mv $lib/${targetPlatformSlash}lib/libgcc_s.so.1 $libgcc/lib/ + ln -s $libgcc/lib/libgcc_s.so $lib/${targetPlatformSlash}lib/ + ln -s $libgcc/lib/libgcc_s.so.1 $lib/${targetPlatformSlash}lib/ '' # # Nixpkgs ordinarily turns dynamic linking into pseudo-static linking: From 96a2f1b4e1315251f1916f64c4632dbf7eb40522 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 16 Jun 2023 14:52:41 -0700 Subject: [PATCH 6/6] gcc: kludge to prevent mass-rebuild This commit is reverted in #240596 (which must go to staging). --- pkgs/development/compilers/gcc/10/default.nix | 5 ++++- pkgs/development/compilers/gcc/11/default.nix | 5 ++++- pkgs/development/compilers/gcc/12/default.nix | 5 ++++- pkgs/development/compilers/gcc/13/default.nix | 5 ++++- pkgs/development/compilers/gcc/4.8/default.nix | 5 ++++- pkgs/development/compilers/gcc/4.9/default.nix | 5 ++++- pkgs/development/compilers/gcc/6/default.nix | 5 ++++- pkgs/development/compilers/gcc/7/default.nix | 5 ++++- pkgs/development/compilers/gcc/8/default.nix | 5 ++++- pkgs/development/compilers/gcc/9/default.nix | 5 ++++- pkgs/development/compilers/gcc/builder.sh | 4 ++-- 11 files changed, 42 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index c61093c67c03..739b6d2e2c1d 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -214,7 +214,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index f61e51e2cabe..ca4540b8c713 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -227,7 +227,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index 9665c2a9fe85..ebc1796ec385 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -271,7 +271,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; diff --git a/pkgs/development/compilers/gcc/13/default.nix b/pkgs/development/compilers/gcc/13/default.nix index 1b73c251ce6f..5fb78cfd7b40 100644 --- a/pkgs/development/compilers/gcc/13/default.nix +++ b/pkgs/development/compilers/gcc/13/default.nix @@ -265,7 +265,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index fa856eff96e5..3625257efe9a 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -232,7 +232,10 @@ lib.pipe (stdenv.mkDerivation ({ '' else null; - inherit noSysDirs staticCompiler langJava withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler langJava libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index bab79f968db3..e433e66b9f69 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -253,7 +253,10 @@ lib.pipe (stdenv.mkDerivation ({ '' else null; - inherit noSysDirs staticCompiler langJava withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler langJava libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index f443babb4b70..f64963b906cf 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -269,7 +269,10 @@ lib.pipe (stdenv.mkDerivation ({ )) ); - inherit noSysDirs staticCompiler langJava withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler langJava libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 5b6ea7ead50a..90785143f05e 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -218,7 +218,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index f903e264b0af..29f0a88c9551 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -199,7 +199,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 289212a13635..29e4117fc6a7 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -213,7 +213,10 @@ lib.pipe (stdenv.mkDerivation ({ ) ''; - inherit noSysDirs staticCompiler withoutTargetLibc + # kludge to prevent a mass-rebuild; will be removed in a PR sent to staging + crossStageStatic = withoutTargetLibc; + + inherit noSysDirs staticCompiler libcCross crossMingw; inherit (callFile ../common/dependencies.nix { }) diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index 892dbb565b8d..5147df1e4cc0 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -135,7 +135,7 @@ if test "$noSysDirs" = "1"; then ) fi - if test "$withoutTargetLibc" == 1; then + if test "$crossStageStatic" == 1; then # We don't want the gcc build to assume there will be a libc providing # limits.h in this stage makeFlagsArray+=( @@ -167,7 +167,7 @@ preConfigure() { rm -Rf zlib fi - if test -n "$crossMingw" -a -n "$withoutTargetLibc"; then + if test -n "$crossMingw" -a -n "$crossStageStatic"; then mkdir -p ../mingw # --with-build-sysroot expects that: cp -R $libcCross/include ../mingw