@@ -2427,7 +2427,7 @@ impl Build {
24272427 _ => {
24282428 return Err ( Error :: new (
24292429 ErrorKind :: ArchitectureInvalid ,
2430- "Unknown architecture for iOS simulator target." ,
2430+ "Unknown architecture for simulator target." ,
24312431 ) ) ;
24322432 }
24332433 }
@@ -2485,7 +2485,8 @@ impl Build {
24852485 ArchSpec :: Catalyst ( _) => "macosx" . to_owned ( ) ,
24862486 } ;
24872487
2488- if !is_mac {
2488+ // AppleClang sometimes requires sysroot even for darwin
2489+ if cmd. is_xctoolchain_clang ( ) || !target. ends_with ( "-darwin" ) {
24892490 self . print ( & format_args ! ( "Detecting {:?} SDK path for {}" , os, sdk) ) ;
24902491 let sdk_path = if let Some ( sdkroot) = env:: var_os ( "SDKROOT" ) {
24912492 sdkroot
@@ -2495,7 +2496,10 @@ impl Build {
24952496
24962497 cmd. args . push ( "-isysroot" . into ( ) ) ;
24972498 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 {
24992503 cmd. args . push ( "-fembed-bitcode" . into ( ) ) ;
25002504 }
25012505
@@ -3684,6 +3688,17 @@ impl Tool {
36843688 self . family == ToolFamily :: Clang
36853689 }
36863690
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+
36873702 /// Whether the tool is MSVC-like.
36883703 pub fn is_like_msvc ( & self ) -> bool {
36893704 match self . family {
0 commit comments