Brendonovich / swift-rs

Call Swift functions from Rust with ease!
Apache License 2.0
246 stars 28 forks source link

Fix the broken cross-compile command with Xcode15 SDK #51

Closed pewsheen closed 11 months ago

pewsheen commented 11 months ago

The original issue is from Tauri#7339: https://github.com/tauri-apps/tauri/issues/7339

The cross-compilation is broken with Xcode15 SDK. swift can't find the ios target's standard library.

error: unable to load standard library for target 'arm64-apple-ios13.0-simulator'

After some tries between Xcode14 and 15 SDK, I found that swift 5.9 (shipped with Xcode15) always seemed to use MacOSX SDK. So I try specified the SDK path for the swift build, and it successfully built the iOS target.

I tested this patch on my macOS 14.0 and for cross-compiling iOS targets only (with Xcode14, 15 SDK). So I need someone to help test if the patch broke something on other use cases.

A mini repository for testing this patch: https://github.com/pewsheen/swift-xcode15-cross-compile

lucasfernog commented 11 months ago

Still works at least on my setup (not using Xcode 15 yet).