Skip to content

Commit 2987d66

Browse files
thefloweringashEricson2314
authored andcommitted
llvmPackages_11.compiler-rt: fix build on x86_64-darwin
Amendment to changes in 56fcbcd. Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
1 parent 84afb3a commit 2987d66

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

pkgs/development/compilers/llvm/11/compiler-rt/default.nix

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
let
44

55
useLLVM = stdenv.hostPlatform.useLLVM or false;
6-
isDarwin = stdenv.hostPlatform.isDarwin;
6+
isNewDarwinBootstrap = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
77
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
88
haveLibc = stdenv.cc.libc != null;
99
inherit (stdenv.hostPlatform) isMusl;
@@ -25,19 +25,19 @@ stdenv.mkDerivation {
2525
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
2626
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
2727
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
28-
] ++ lib.optionals (useLLVM || isDarwin || bareMetal || isMusl) [
28+
] ++ lib.optionals (useLLVM || bareMetal || isMusl || isNewDarwinBootstrap) [
2929
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
3030
"-DCOMPILER_RT_BUILD_XRAY=OFF"
3131
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
3232
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
33-
] ++ lib.optionals ((useLLVM || isDarwin || bareMetal) && !haveLibc) [
33+
] ++ lib.optionals (!haveLibc || bareMetal) [
3434
"-DCMAKE_C_COMPILER_WORKS=ON"
3535
"-DCMAKE_CXX_COMPILER_WORKS=ON"
3636
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
3737
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
38-
] ++ lib.optionals ((useLLVM || isDarwin) && !haveLibc) [
38+
] ++ lib.optionals (!haveLibc) [
3939
"-DCMAKE_C_FLAGS=-nodefaultlibs"
40-
] ++ lib.optionals (useLLVM || isDarwin) [
40+
] ++ lib.optionals (useLLVM || isNewDarwinBootstrap) [
4141
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
4242
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
4343
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
@@ -62,7 +62,7 @@ stdenv.mkDerivation {
6262
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
6363

6464

65-
preConfigure = lib.optionalString isDarwin ''
65+
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
6666
cmakeFlagsArray+=("-DCMAKE_LIPO=$(command -v ${stdenv.cc.targetPrefix}lipo)")
6767
'';
6868

pkgs/development/compilers/llvm/11/default.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,14 @@ let
213213

214214
compiler-rt-libc = callPackage ./compiler-rt {
215215
inherit llvm_meta;
216-
stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin
216+
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
217217
then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
218218
else stdenv;
219219
};
220220

221221
compiler-rt-no-libc = callPackage ./compiler-rt {
222222
inherit llvm_meta;
223-
stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin
223+
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
224224
then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
225225
else stdenv;
226226
};
@@ -236,21 +236,21 @@ let
236236

237237
libcxx = callPackage ./libcxx {
238238
inherit llvm_meta;
239-
stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin
239+
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
240240
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
241241
else stdenv;
242242
};
243243

244244
libcxxabi = callPackage ./libcxxabi {
245245
inherit llvm_meta;
246-
stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin
246+
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
247247
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
248248
else stdenv;
249249
};
250250

251251
libunwind = callPackage ./libunwind {
252252
inherit llvm_meta;
253-
stdenv = if (stdenv.hostPlatform.useLLVM or false) || stdenv.hostPlatform.isDarwin
253+
stdenv = if (stdenv.hostPlatform.useLLVM or false) || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
254254
then overrideCC stdenv buildLlvmTools.clangNoLibcxx
255255
else stdenv;
256256
};

0 commit comments

Comments
 (0)