diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 1b9f542894e0..aead3fa21fff 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -191,7 +191,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit; + inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/11/default.nix b/pkgs/development/compilers/gcc/11/default.nix index 1dc9ed0a2679..1522569cccce 100644 --- a/pkgs/development/compilers/gcc/11/default.nix +++ b/pkgs/development/compilers/gcc/11/default.nix @@ -199,7 +199,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit; + inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/12/default.nix b/pkgs/development/compilers/gcc/12/default.nix index 20bc9dcf44bb..2279a8b5cccc 100644 --- a/pkgs/development/compilers/gcc/12/default.nix +++ b/pkgs/development/compilers/gcc/12/default.nix @@ -194,7 +194,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit; + inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index 8cd0d3c9ce80..473bd39e406f 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -198,7 +198,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform langJava langGo; + inherit version targetPlatform hostPlatform langJava langGo crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 571d0b023124..9d9dae41c453 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -218,7 +218,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform langJava langGo; + inherit version targetPlatform hostPlatform langJava langGo crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 62b46df1ab00..a5be86ca0522 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -230,7 +230,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo; + inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 1abf14c8a8c7..7a9a6938fe76 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -197,7 +197,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform langGo; + inherit version targetPlatform hostPlatform langGo crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 2dd265b648ce..427244016ae1 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -180,7 +180,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform langGo; + inherit version targetPlatform hostPlatform langGo crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index 30ae18e49173..602560364452 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -193,7 +193,7 @@ stdenv.mkDerivation ({ preConfigure = import ../common/pre-configure.nix { inherit lib; - inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit; + inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit crossStageStatic; }; dontDisableStatic = true; diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix index 310e7f8b574b..180d5f16e91f 100644 --- a/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -3,7 +3,9 @@ , langAda ? false , langJava ? false , langJit ? false -, langGo }: +, langGo +, crossStageStatic +}: assert langJava -> lib.versionOlder version "7"; assert langAda -> gnatboot != null; let @@ -67,3 +69,12 @@ in lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' + lib.optionalString (targetPlatform.config == hostPlatform.config && targetPlatform != hostPlatform) '' substituteInPlace configure --replace is_cross_compiler=no is_cross_compiler=yes '' + +# Normally (for host != target case) --without-headers automatically +# enables 'inhibit_libc=true' in gcc's gcc/configure.ac. But case of +# 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) '' + export inhibit_libc=true +''