2

Background

I'm compiling a native library written in Rust for watchOS target using cargo swift package. I'm using Xcode 16.4 that shipped with watchOS SDK watchOS 11.5. The watchOS app's minimum deployment target is 9.6, it is because my Apple Watch test device cannot be updated to the latest version. It runs watchOS 10.6. The watchOS 9.6 requires watchOS 9.4 SDK that comes with Xcode 14.3.

However, the cargo swift package will use the default SDK that comes with Xcode, that is, watchOS 11.5 SDK.

setoelkahfi@Heighliner1 wallet-kit-v3 % xcrun --sdk watchos --show-sdk-path
/Applications/Xcode-16.4.0.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.5.sdk

This is problematic because in the Xcode project, I get warnings telling me that I compile the XCFramework library with the latest SDK but link it with the lower SDK version.

Question

Is it possible to use Xcode 16.4 and set the default watchOS SDK to version watchOS 9.4? I want to avoid having to install Xcode 14.3 that comes with the watchOS 9.4 SDK.

1 Answer 1

1

Answered in detail in the Rust repo.

I need to provide the WATCHOS_DEPLOYMENT_TARGET=9 environment variable when running cargo swift package. It fixes the warnings in the Xcode.

Full command that solves the problem:

WATCHOS_DEPLOYMENT_TARGET=9 cargo run --manifest-path ../../cargo-swift/Cargo.toml swift package -p watchos -n WalletKitV3 -r

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.