Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc*: force building a cross compiler if host and target platform differ #123419

Merged
merged 1 commit into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/4.8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform langJava langGo;
inherit version targetPlatform hostPlatform langJava langGo;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/4.9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform langJava langGo;
inherit version targetPlatform hostPlatform langJava langGo;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform gnatboot langJava langAda langGo;
inherit version targetPlatform hostPlatform gnatboot langJava langAda langGo;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform langGo;
inherit version targetPlatform hostPlatform langGo;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform langGo;
inherit version targetPlatform hostPlatform langGo;
};

dontDisableStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gcc/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ stdenv.mkDerivation ({

preConfigure = import ../common/pre-configure.nix {
inherit lib;
inherit version hostPlatform gnatboot langAda langGo langJit;
inherit version targetPlatform hostPlatform gnatboot langAda langGo langJit;
};

dontDisableStatic = true;
Expand Down
9 changes: 8 additions & 1 deletion pkgs/development/compilers/gcc/common/pre-configure.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, version, hostPlatform
{ lib, version, hostPlatform, targetPlatform
, gnatboot ? null
, langAda ? false
, langJava ? false
Expand Down Expand Up @@ -58,3 +58,10 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
+ lib.optionalString (hostPlatform.isDarwin && langJit) ''
export STRIP='strip -x'
''

# HACK: if host and target config are the same, but the platforms are
# actually different we need to convince the configure script that it
# is in fact building a cross compiler although it doesn't believe it.
+ lib.optionalString (targetPlatform.config == hostPlatform.config && targetPlatform != hostPlatform) ''
substituteInPlace configure --replace is_cross_compiler=no is_cross_compiler=yes
''