Add `/System/iOSSupport` to the library search path on Mac Catalyst

This commit is contained in:
Mads Marquart 2024-02-22 03:06:25 +01:00
parent b14d8b2ef2
commit e27290e529
1 changed files with 10 additions and 0 deletions

View File

@ -2997,6 +2997,16 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
}
_ => unreachable!(),
}
if llvm_target.contains("macabi") {
// Mac Catalyst uses the macOS SDK, but to link to iOS-specific
// frameworks, we must have the support library stubs in the library
// search path.
// The flags are called `-L` and `-F` both in Clang, ld64 and ldd.
cmd.arg(format!("-L{sdk_root}/System/iOSSupport/usr/lib"));
cmd.arg(format!("-F{sdk_root}/System/iOSSupport/System/Library/Frameworks"));
}
}
fn get_apple_sdk_root(sdk_name: &str) -> Result<String, errors::AppleSdkRootError<'_>> {