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