@@ -2111,7 +2111,7 @@ impl Build {
2111
2111
None => false ,
2112
2112
} ;
2113
2113
2114
- let is_sim = match target. split ( '-' ) . nth ( 3 ) {
2114
+ let is_arm_sim = match target. split ( '-' ) . nth ( 3 ) {
2115
2115
Some ( v) => v == "sim" ,
2116
2116
None => false ,
2117
2117
} ;
@@ -2139,14 +2139,14 @@ impl Build {
2139
2139
) ) ;
2140
2140
}
2141
2141
}
2142
- } else if is_sim {
2142
+ } else if is_arm_sim {
2143
2143
match arch {
2144
2144
"arm64" | "aarch64" => ArchSpec :: Simulator ( "-arch arm64" ) ,
2145
2145
"x86_64" => ArchSpec :: Simulator ( "-m64" ) ,
2146
2146
_ => {
2147
2147
return Err ( Error :: new (
2148
2148
ErrorKind :: ArchitectureInvalid ,
2149
- "Unknown architecture for iOS simulator target." ,
2149
+ "Unknown architecture for simulator target." ,
2150
2150
) ) ;
2151
2151
}
2152
2152
}
@@ -2210,11 +2210,15 @@ impl Build {
2210
2210
ArchSpec :: Catalyst ( _) => "macosx" . to_owned ( ) ,
2211
2211
} ;
2212
2212
2213
- if !is_mac {
2213
+ // AppleClang sometimes needs sysroot even for darwin
2214
+ if cmd. is_xctoolchain_clang ( ) || !target. ends_with ( "-darwin" ) {
2214
2215
self . print ( & format ! ( "Detecting {} SDK path for {}" , os, sdk) ) ;
2215
2216
let sdk_path = self . apple_sdk_root ( sdk. as_str ( ) ) ?;
2216
2217
cmd. args . push ( "-isysroot" . into ( ) ) ;
2217
2218
cmd. args . push ( sdk_path) ;
2219
+ }
2220
+
2221
+ if !is_mac {
2218
2222
cmd. args . push ( "-fembed-bitcode" . into ( ) ) ;
2219
2223
}
2220
2224
/*
@@ -3112,6 +3116,17 @@ impl Tool {
3112
3116
self . family == ToolFamily :: Clang
3113
3117
}
3114
3118
3119
+ /// Whether the tool is AppleClang under .xctoolchain
3120
+ #[ cfg( target_vendor = "apple" ) ]
3121
+ fn is_xctoolchain_clang ( & self ) -> bool {
3122
+ let path = self . path . to_str ( ) . unwrap ( ) ;
3123
+ path. contains ( ".xctoolchain/" )
3124
+ }
3125
+ #[ cfg( not( target_vendor = "apple" ) ) ]
3126
+ fn is_xctoolchain_clang ( & self ) -> bool {
3127
+ false
3128
+ }
3129
+
3115
3130
/// Whether the tool is MSVC-like.
3116
3131
pub fn is_like_msvc ( & self ) -> bool {
3117
3132
match self . family {
0 commit comments