Skip to content

unable to find sdk '<platform>' when building Swift package against a Swift SDK with target-platform specialization #1325

Description

@MaxDesiatov

When SwiftPM (swiftbuild build system) builds a multi-target Swift package against a Wasm Swift SDK, the build fails during dependency resolution / settings construction with:

error: unable to find sdk 'webassembly'
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no active architecture could be computed; building for all applicable architectures
error: Build failed

The same root cause should affect any platform that has only a Swift SDK installed (no built-in or platform-extension-registered SDK with the platform's canonical name) — Wasm is the most exposed today because SWBWebAssemblyPlatform does not register a fallback SDK the way SWBAndroidPlatform's AndroidSDKRegistryExtension does.

This is the follow-up to #1267 / #1266: addRunDestinationSettingsPlatformSDK is one of two sites that push the platform-name canonical-SDK string for Swift-SDK-backed builds.

Reproduction

https://github.com/swiftwasm/JavaScriptKit, commit ff90c3e:

TOOLCHAINS=<recent-main-snapshot> \
  swift package --swift-sdk swift-DEVELOPMENT-SNAPSHOT_wasm \
  --traits Tracing --disable-sandbox \
  js test --build-only --prelude ./Tests/prelude.mjs
Building for debugging...
Computing dependencies
Provisioning 19 / 60
error: unable to find sdk 'webassembly'
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no active architecture could be computed; building for all applicable architectures
error: Build failed

(Workaround: --build-system native succeeds — the legacy build system is unaffected.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions