@@ -2163,7 +2163,7 @@ impl Build {
21632163 _ => {
21642164 return Err ( Error :: new (
21652165 ErrorKind :: ArchitectureInvalid ,
2166- "Unknown architecture for iOS simulator target." ,
2166+ "Unknown architecture for simulator target." ,
21672167 ) ) ;
21682168 }
21692169 }
@@ -2233,7 +2233,8 @@ impl Build {
22332233 ArchSpec :: Catalyst ( _) => "macosx" . to_owned ( ) ,
22342234 } ;
22352235
2236- if !is_mac {
2236+ // AppleClang sometimes needs sysroot even for darwin
2237+ if cmd. is_xctoolchain_clang ( ) || !target. ends_with ( "-darwin" ) {
22372238 self . print ( & format ! ( "Detecting {} SDK path for {}" , os, sdk) ) ;
22382239 let sdk_path = if let Some ( sdkroot) = env:: var_os ( "SDKROOT" ) {
22392240 sdkroot
@@ -2242,6 +2243,9 @@ impl Build {
22422243 } ;
22432244 cmd. args . push ( "-isysroot" . into ( ) ) ;
22442245 cmd. args . push ( sdk_path) ;
2246+ }
2247+
2248+ if !is_mac {
22452249 cmd. args . push ( "-fembed-bitcode" . into ( ) ) ;
22462250 }
22472251 /*
@@ -3155,6 +3159,17 @@ impl Tool {
31553159 self . family == ToolFamily :: Clang
31563160 }
31573161
3162+ /// Whether the tool is AppleClang under .xctoolchain
3163+ #[ cfg( target_vendor = "apple" ) ]
3164+ fn is_xctoolchain_clang ( & self ) -> bool {
3165+ let path = self . path . to_str ( ) . unwrap ( ) ;
3166+ path. contains ( ".xctoolchain/" )
3167+ }
3168+ #[ cfg( not( target_vendor = "apple" ) ) ]
3169+ fn is_xctoolchain_clang ( & self ) -> bool {
3170+ false
3171+ }
3172+
31583173 /// Whether the tool is MSVC-like.
31593174 pub fn is_like_msvc ( & self ) -> bool {
31603175 match self . family {
0 commit comments