From b90cd11c48d2c22bf7d60b1fe12cdb0040bf2823 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Fri, 16 Apr 2021 10:33:28 +0200 Subject: [PATCH] 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. --- pkgs/top-level/all-packages.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8a5bb51863e..30fd9cd4828 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {