glibc: always compile with a gcc stdenv

Our glibc doesn't compile with clang and useLLVM doesn't make the stdenv
implicitly switch to musl (and arguably shouldn't do that). To make LLVM
cross compilation without patching glibc to compile with clang (which is
probably a lot of work), always compile glibc with gcc. This should
unbreak a lot of cross compilation tests, I have tested:

* tests.cross.llvm.gnu64
* tests.cross.llvm.aarch64-multiplatform

Basing against staging because this change only really makes sense if
useLLVM works with llvmPackages_7 which is only the case in staging at
the moment.
This commit is contained in:
sternenseemann 2021-04-16 10:33:28 +02:00
parent 5478217883
commit b90cd11c48

View File

@ -10257,10 +10257,12 @@ in
stripped = false;
}));
crossLibcStdenv = overrideCC stdenv
(if stdenv.hostPlatform.useLLVM or false
then buildPackages.llvmPackages_8.lldClangNoLibc
else buildPackages.gccCrossStageStatic);
gccCrossLibcStdenv = overrideCC stdenv buildPackages.gccCrossStageStatic;
crossLibcStdenv =
if stdenv.hostPlatform.useLLVM or false
then overrideCC stdenv buildPackages.llvmPackages_8.lldClangNoLibc
else gccCrossLibcStdenv;
# The GCC used to build libc for the target platform. Normal gccs will be
# built with, and use, that cross-compiled libc.
@ -14463,7 +14465,9 @@ in
inherit (darwin.apple_sdk.frameworks) Cocoa Kernel;
};
glibc = callPackage ../development/libraries/glibc { };
glibc = callPackage ../development/libraries/glibc {
stdenv = gccStdenv; # doesn't compile without gcc
};
# Provided by libc on Operating Systems that use the Extensible Linker Format.
elf-header =
@ -14479,7 +14483,7 @@ in
# Being redundant to avoid cycles on boot. TODO: find a better way
glibcCross = callPackage ../development/libraries/glibc {
stdenv = crossLibcStdenv;
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
};
muslCross = musl.override {