mirror of
https://github.com/FluxaMedia/fluxa.git
synced 2026-08-18 21:18:32 +00:00
Force SDKROOT per Rust target when building inside an Xcode script phase
The Xcode "Build Fluxa Rust Core" run-script phase runs this script with SDKROOT already exported for whichever platform Xcode is currently building (e.g. iphonesimulator for the FluxaIos scheme). That ambient value leaks into cc's default sysroot for every target this script loops over, including unrelated ones, so linking the aarch64-apple-tvos build picked up an iphonesimulator libiconv and failed with "building for tvOS, but linking in dylib built for iOS-simulator". Override SDKROOT per target using the same SDK path already resolved for bindgen, so each cargo build gets a sysroot matching its own target.
This commit is contained in:
parent
71e5d90b90
commit
97628a1fe2
1 changed files with 3 additions and 0 deletions
|
|
@ -47,6 +47,7 @@ build_rust_core() {
|
|||
|
||||
local bindgen_env=()
|
||||
local deployment_env=()
|
||||
local sdkroot_env=()
|
||||
if [[ -n "$rust_target" ]]; then
|
||||
local sdk clang_triple sdk_path
|
||||
sdk="$(apple_sdk_for_rust_target "$rust_target")"
|
||||
|
|
@ -57,6 +58,7 @@ build_rust_core() {
|
|||
"LIBCLANG_PATH=$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib"
|
||||
"BINDGEN_EXTRA_CLANG_ARGS=--target=$clang_triple --sysroot=$sdk_path -isysroot $sdk_path"
|
||||
)
|
||||
sdkroot_env=("SDKROOT=$sdk_path")
|
||||
fi
|
||||
case "$sdk" in
|
||||
iphoneos | iphonesimulator)
|
||||
|
|
@ -74,6 +76,7 @@ build_rust_core() {
|
|||
local env_args=()
|
||||
[[ ${#bindgen_env[@]} -gt 0 ]] && env_args+=("${bindgen_env[@]}")
|
||||
[[ ${#deployment_env[@]} -gt 0 ]] && env_args+=("${deployment_env[@]}")
|
||||
[[ ${#sdkroot_env[@]} -gt 0 ]] && env_args+=("${sdkroot_env[@]}")
|
||||
if [[ ${#env_args[@]} -gt 0 ]]; then
|
||||
env "${env_args[@]}" "${cargo_cmd[@]}"
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue