gcc{6,7,8,9,10,11}: fix cross-compiler build on x86_64-darwin

Building a cross-compiler fails due to register storage class specifier
errors when building with clang 16 due to its defaulting to C++17.
Downgrading the error allows the older cross-compilers to build.
This commit is contained in:
Randy Eckenrode 2023-12-02 18:43:00 -05:00
parent 4a538d6b3d
commit f2a7764cab
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -392,7 +392,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
EXTRA_LDFLAGS_FOR_TARGET
;
} // optionalAttrs is7 {
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument"
# Downgrade register storage class specifier errors to warnings when building a cross compiler from a clang stdenv.
+ lib.optionalString (stdenv.cc.isClang && targetPlatform != hostPlatform) " -Wno-register";
} // optionalAttrs (!is7 && !atLeast12 && stdenv.cc.isClang && targetPlatform != hostPlatform) {
NIX_CFLAGS_COMPILE = "-Wno-register";
} // optionalAttrs (!atLeast7) {
inherit langJava;
} // optionalAttrs atLeast6 {