@@ -2515,7 +2515,8 @@ impl Build {
2515
2515
ArchSpec :: Catalyst ( _) => "macosx" . to_owned ( ) ,
2516
2516
} ;
2517
2517
2518
- if !is_mac {
2518
+ // AppleClang sometimes requires sysroot even for darwin
2519
+ if cmd. is_xctoolchain_clang ( ) || !target. ends_with ( "-darwin" ) {
2519
2520
self . print ( & format_args ! ( "Detecting {:?} SDK path for {}" , os, sdk) ) ;
2520
2521
let sdk_path = if let Some ( sdkroot) = env:: var_os ( "SDKROOT" ) {
2521
2522
sdkroot
@@ -2525,7 +2526,10 @@ impl Build {
2525
2526
2526
2527
cmd. args . push ( "-isysroot" . into ( ) ) ;
2527
2528
cmd. args . push ( sdk_path) ;
2528
- // TODO: Remove this once Apple stops accepting apps built with Xcode 13
2529
+ }
2530
+
2531
+ // TODO: Remove this once Apple stops accepting apps built with Xcode 13
2532
+ if !is_mac {
2529
2533
cmd. args . push ( "-fembed-bitcode" . into ( ) ) ;
2530
2534
}
2531
2535
@@ -3718,6 +3722,17 @@ impl Tool {
3718
3722
self . family == ToolFamily :: Clang
3719
3723
}
3720
3724
3725
+ /// Whether the tool is AppleClang under .xctoolchain
3726
+ #[ cfg( target_vendor = "apple" ) ]
3727
+ fn is_xctoolchain_clang ( & self ) -> bool {
3728
+ let path = self . path . to_string_lossy ( ) ;
3729
+ path. contains ( ".xctoolchain/" )
3730
+ }
3731
+ #[ cfg( not( target_vendor = "apple" ) ) ]
3732
+ fn is_xctoolchain_clang ( & self ) -> bool {
3733
+ false
3734
+ }
3735
+
3721
3736
/// Whether the tool is MSVC-like.
3722
3737
pub fn is_like_msvc ( & self ) -> bool {
3723
3738
match self . family {
0 commit comments