@@ -2427,7 +2427,7 @@ impl Build {
2427
2427
_ => {
2428
2428
return Err ( Error :: new (
2429
2429
ErrorKind :: ArchitectureInvalid ,
2430
- "Unknown architecture for iOS simulator target." ,
2430
+ "Unknown architecture for simulator target." ,
2431
2431
) ) ;
2432
2432
}
2433
2433
}
@@ -2485,7 +2485,8 @@ impl Build {
2485
2485
ArchSpec :: Catalyst ( _) => "macosx" . to_owned ( ) ,
2486
2486
} ;
2487
2487
2488
- if !is_mac {
2488
+ // AppleClang sometimes requires sysroot even for darwin
2489
+ if cmd. is_xctoolchain_clang ( ) || !target. ends_with ( "-darwin" ) {
2489
2490
self . print ( & format_args ! ( "Detecting {:?} SDK path for {}" , os, sdk) ) ;
2490
2491
let sdk_path = if let Some ( sdkroot) = env:: var_os ( "SDKROOT" ) {
2491
2492
sdkroot
@@ -2495,7 +2496,10 @@ impl Build {
2495
2496
2496
2497
cmd. args . push ( "-isysroot" . into ( ) ) ;
2497
2498
cmd. args . push ( sdk_path) ;
2498
- // TODO: Remove this once Apple stops accepting apps built with Xcode 13
2499
+ }
2500
+
2501
+ // TODO: Remove this once Apple stops accepting apps built with Xcode 13
2502
+ if !is_mac {
2499
2503
cmd. args . push ( "-fembed-bitcode" . into ( ) ) ;
2500
2504
}
2501
2505
@@ -3684,6 +3688,17 @@ impl Tool {
3684
3688
self . family == ToolFamily :: Clang
3685
3689
}
3686
3690
3691
+ /// Whether the tool is AppleClang under .xctoolchain
3692
+ #[ cfg( target_vendor = "apple" ) ]
3693
+ fn is_xctoolchain_clang ( & self ) -> bool {
3694
+ let path = self . path . to_str ( ) . unwrap ( ) ;
3695
+ path. contains ( ".xctoolchain/" )
3696
+ }
3697
+ #[ cfg( not( target_vendor = "apple" ) ) ]
3698
+ fn is_xctoolchain_clang ( & self ) -> bool {
3699
+ false
3700
+ }
3701
+
3687
3702
/// Whether the tool is MSVC-like.
3688
3703
pub fn is_like_msvc ( & self ) -> bool {
3689
3704
match self . family {
0 commit comments