@@ -2163,7 +2163,7 @@ impl Build {
2163
2163
_ => {
2164
2164
return Err ( Error :: new (
2165
2165
ErrorKind :: ArchitectureInvalid ,
2166
- "Unknown architecture for iOS simulator target." ,
2166
+ "Unknown architecture for simulator target." ,
2167
2167
) ) ;
2168
2168
}
2169
2169
}
@@ -2233,7 +2233,8 @@ impl Build {
2233
2233
ArchSpec :: Catalyst ( _) => "macosx" . to_owned ( ) ,
2234
2234
} ;
2235
2235
2236
- if !is_mac {
2236
+ // AppleClang sometimes needs sysroot even for darwin
2237
+ if cmd. is_xctoolchain_clang ( ) || !target. ends_with ( "-darwin" ) {
2237
2238
self . print ( & format ! ( "Detecting {} SDK path for {}" , os, sdk) ) ;
2238
2239
let sdk_path = if let Some ( sdkroot) = env:: var_os ( "SDKROOT" ) {
2239
2240
sdkroot
@@ -2242,6 +2243,9 @@ impl Build {
2242
2243
} ;
2243
2244
cmd. args . push ( "-isysroot" . into ( ) ) ;
2244
2245
cmd. args . push ( sdk_path) ;
2246
+ }
2247
+
2248
+ if !is_mac {
2245
2249
cmd. args . push ( "-fembed-bitcode" . into ( ) ) ;
2246
2250
}
2247
2251
/*
@@ -3155,6 +3159,17 @@ impl Tool {
3155
3159
self . family == ToolFamily :: Clang
3156
3160
}
3157
3161
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
+
3158
3173
/// Whether the tool is MSVC-like.
3159
3174
pub fn is_like_msvc ( & self ) -> bool {
3160
3175
match self . family {
0 commit comments