@@ -264,7 +264,7 @@ impl Step for Llvm {
264
264
cfg. define ( "PYTHON_EXECUTABLE" , python) ;
265
265
}
266
266
267
- configure_cmake ( builder, target, & mut cfg) ;
267
+ configure_cmake ( builder, target, & mut cfg, true ) ;
268
268
269
269
// FIXME: we don't actually need to build all LLVM tools and all LLVM
270
270
// libraries here, e.g., we just want a few components and a few
@@ -303,7 +303,12 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) {
303
303
panic ! ( "\n \n bad LLVM version: {}, need >=7.0\n \n " , version)
304
304
}
305
305
306
- fn configure_cmake ( builder : & Builder < ' _ > , target : Interned < String > , cfg : & mut cmake:: Config ) {
306
+ fn configure_cmake (
307
+ builder : & Builder < ' _ > ,
308
+ target : Interned < String > ,
309
+ cfg : & mut cmake:: Config ,
310
+ use_compiler_launcher : bool ,
311
+ ) {
307
312
// Do not print installation messages for up-to-date files.
308
313
// LLVM and LLD builds can produce a lot of those and hit CI limits on log size.
309
314
cfg. define ( "CMAKE_INSTALL_MESSAGE" , "LAZY" ) ;
@@ -374,9 +379,11 @@ fn configure_cmake(builder: &Builder<'_>, target: Interned<String>, cfg: &mut cm
374
379
} else {
375
380
// If ccache is configured we inform the build a little differently how
376
381
// to invoke ccache while also invoking our compilers.
377
- if let Some ( ref ccache) = builder. config . ccache {
378
- cfg. define ( "CMAKE_C_COMPILER_LAUNCHER" , ccache)
379
- . define ( "CMAKE_CXX_COMPILER_LAUNCHER" , ccache) ;
382
+ if use_compiler_launcher {
383
+ if let Some ( ref ccache) = builder. config . ccache {
384
+ cfg. define ( "CMAKE_C_COMPILER_LAUNCHER" , ccache)
385
+ . define ( "CMAKE_CXX_COMPILER_LAUNCHER" , ccache) ;
386
+ }
380
387
}
381
388
cfg. define ( "CMAKE_C_COMPILER" , sanitize_cc ( cc) )
382
389
. define ( "CMAKE_CXX_COMPILER" , sanitize_cc ( cxx) ) ;
@@ -460,7 +467,7 @@ impl Step for Lld {
460
467
t ! ( fs:: create_dir_all( & out_dir) ) ;
461
468
462
469
let mut cfg = cmake:: Config :: new ( builder. src . join ( "src/llvm-project/lld" ) ) ;
463
- configure_cmake ( builder, target, & mut cfg) ;
470
+ configure_cmake ( builder, target, & mut cfg, true ) ;
464
471
465
472
// This is an awful, awful hack. Discovered when we migrated to using
466
473
// clang-cl to compile LLVM/LLD it turns out that LLD, when built out of
@@ -597,10 +604,7 @@ impl Step for Sanitizers {
597
604
let _time = util:: timeit ( & builder) ;
598
605
599
606
let mut cfg = cmake:: Config :: new ( & compiler_rt_dir) ;
600
- cfg. target ( & self . target ) ;
601
- cfg. host ( & builder. config . build ) ;
602
607
cfg. profile ( "Release" ) ;
603
-
604
608
cfg. define ( "CMAKE_C_COMPILER_TARGET" , self . target ) ;
605
609
cfg. define ( "COMPILER_RT_BUILD_BUILTINS" , "OFF" ) ;
606
610
cfg. define ( "COMPILER_RT_BUILD_CRT" , "OFF" ) ;
@@ -612,6 +616,12 @@ impl Step for Sanitizers {
612
616
cfg. define ( "COMPILER_RT_USE_LIBCXX" , "OFF" ) ;
613
617
cfg. define ( "LLVM_CONFIG_PATH" , & llvm_config) ;
614
618
619
+ // On Darwin targets the sanitizer runtimes are build as universal binaries.
620
+ // Unfortunately sccache currently lacks support to build them successfully.
621
+ // Disable compiler launcher on Darwin targets to avoid potential issues.
622
+ let use_compiler_launcher = !self . target . contains ( "apple-darwin" ) ;
623
+ configure_cmake ( builder, self . target , & mut cfg, use_compiler_launcher) ;
624
+
615
625
t ! ( fs:: create_dir_all( & out_dir) ) ;
616
626
cfg. out_dir ( out_dir) ;
617
627
0 commit comments