Description
Follow-up from #773.
SwiftBuild currently rewrites SDKROOT=auto to a platform SDK name, but that is incorrect for Swift SDK destinations. Swift SDK destinations derive their SDK identity from the Swift SDK manifest, and rewriting SDKROOT=auto to something like webassembly can fail because there is no separately registered platform SDK with that name.
The attached reproducer is JavaScriptKit-agnostic and exercises this through a command plugin that calls packageManager.build(.product("SDKRootAutoReproPackageTests"), ...) while targeting a wasm Swift SDK destination.
Expected behavior
When the active run destination is a Swift SDK destination, the existing SDKROOT=auto rewrite path should not run.
Swift SDK destinations should retain their manifest-defined SDK identity, and wasm Swift SDK builds should not fail because of a rewritten platform SDK name.
Actual behavior
With swift-DEVELOPMENT-SNAPSHOT-2026-06-12-a_wasm, the native/control path succeeds and builds SDKRootAutoReproPackageTests.
The same reproducer with --build-system swiftbuild fails with:
succeeded: false
error: unable to find sdk 'webassembly'
error: Build failed
This matches the original failure mode.
Steps to reproduce
Updated reproducer zip: https://gist.githubusercontent.com/kateinoigakukun/ba21c654a675032aa77906877c906e53/raw/4fb7bfb28eecb50f20973c4c3299e5e82ba222c1/780-sdkroot-auto-linux-2026-06-12.zip
The updated zip preserves the original repro.sh and includes repro-linux-2026-06-12.sh plus adaptation notes for the Linux snapshot run.
unzip 780-sdkroot-auto.zip
cd 780-sdkroot-auto
TOOLCHAIN=/home/ubuntu/.local/share/swiftly/toolchains/main-snapshot-2026-06-12 \
SWIFT_SDK=swift-DEVELOPMENT-SNAPSHOT-2026-06-12-a_wasm \
./repro-linux-2026-06-12.sh
On macOS with the original 2026-05-27 snapshot setup described in the original reproducer, ./repro.sh preserves the original invocation shape.
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.5.0-dev
Swift & OS version (output of swift --version ; uname -a)
Swift version 6.5-dev (LLVM 18d2bfb70c14d89, Swift c13d82e5987aecb)
Target: x86_64-unknown-linux-gnu
Build config: +assertions
Linux swift-dev.fugu.katei.dev 6.8.0-94-generic #96-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 9 20:36:55 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Description
Follow-up from #773.
SwiftBuild currently rewrites
SDKROOT=autoto a platform SDK name, but that is incorrect for Swift SDK destinations. Swift SDK destinations derive their SDK identity from the Swift SDK manifest, and rewritingSDKROOT=autoto something likewebassemblycan fail because there is no separately registered platform SDK with that name.The attached reproducer is JavaScriptKit-agnostic and exercises this through a command plugin that calls
packageManager.build(.product("SDKRootAutoReproPackageTests"), ...)while targeting a wasm Swift SDK destination.Expected behavior
When the active run destination is a Swift SDK destination, the existing
SDKROOT=autorewrite path should not run.Swift SDK destinations should retain their manifest-defined SDK identity, and wasm Swift SDK builds should not fail because of a rewritten platform SDK name.
Actual behavior
With
swift-DEVELOPMENT-SNAPSHOT-2026-06-12-a_wasm, the native/control path succeeds and buildsSDKRootAutoReproPackageTests.The same reproducer with
--build-system swiftbuildfails with:This matches the original failure mode.
Steps to reproduce
Updated reproducer zip:
https://gist.githubusercontent.com/kateinoigakukun/ba21c654a675032aa77906877c906e53/raw/4fb7bfb28eecb50f20973c4c3299e5e82ba222c1/780-sdkroot-auto-linux-2026-06-12.zipThe updated zip preserves the original
repro.shand includesrepro-linux-2026-06-12.shplus adaptation notes for the Linux snapshot run.unzip 780-sdkroot-auto.zip cd 780-sdkroot-auto TOOLCHAIN=/home/ubuntu/.local/share/swiftly/toolchains/main-snapshot-2026-06-12 \ SWIFT_SDK=swift-DEVELOPMENT-SNAPSHOT-2026-06-12-a_wasm \ ./repro-linux-2026-06-12.shOn macOS with the original 2026-05-27 snapshot setup described in the original reproducer,
./repro.shpreserves the original invocation shape.Swift Package Manager version/commit hash
Swift & OS version (output of
swift --version ; uname -a)