`*-apple-watchos` target doesn't reflect `SDKROOT` path

I'm trying to cross compile a Rust uniffi crate to watchOS 9.4 SDK target and export it to a Swift package using cargo swift package.

Initially I used Xcode 16.4 to compile the crate and got warnings because my minimum deployment target for my watchOS app is watchOS 9 and Xcode 16.4 comes with SDK 11.5. That makes sense.

Now, I downloaded Xcode 14.3 that comes with watchOS SDK 9.4 and xcrun --sdk watchos --show-sdk-path shows the right SDK version:

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

I compiled the crate using cargo swift package and it succeded. When I run the watchOS app Xcode project, I still got warnings saying I built the XCFramework library with SDK 26. That couldn't be true, could it?

Image

The strange part is I don't even have Xcode 26 installed.

Related

Are you testing with Rust nightly? It had fixes related to this recently.

Just got a help from a friend. I missed another environment variable mentioned in the docs, that is
WATCHOS_DEPLOYMENT_TARGET.

WATCHOS_DEPLOYMENT_TARGET=9 cargo swift package -p ios watchos -n WalletKitV3 -r

Another point is that the Xcode version doesn't affect the result.

But it doesn't solve my actual problem, which I'll post to another thread later on.

I need to mention that I use Xcode 26 now,

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.