-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is it reproducible with SwiftPM command-line tools: swift build
, swift test
, swift package
etc?
- Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands,
swift build
,swift test
,swift package
etc.
Description
When building with a multi-architecture Swift SDK using both --swift-sdk
and --triple
, SwiftPM nondeterministically selects the wrong architecture variant from the SDK bundle, ignoring the target triple specified via --triple
.
The SDK bundle contains both x86_64 and aarch64 variants, and even though --triple aarch64-swift-linux-musl
is specified, SwiftPM sometimes selects the x86_64 variant instead, causing build failures.
Expected behavior
SwiftPM should select the SDK variant matching the --triple
argument (aarch64) from the multi-arch SDK bundle.
Actual behavior
SwiftPM nondeterministically selects between x86_64 and aarch64 variants
Steps to reproduce
- Install a multi-architecture Swift SDK (SDK contains both x86_64-swift-linux-musl and aarch64-swift-linux-musl)
$swift sdk list
# Output: swift-6.2-RELEASE_static-linux-0.0.1 - Create a minimal test package:
$mkdir -p /tmp/swiftpm-bug-repro && cd /tmp/swiftpm-bug-repro
$swift package init --type executable --name TestApp
- Build for aarch64 Linux:
$swift build --swift-sdk swift-6.2-RELEASE_static-linux-0.0.1 --triple aarch64-swift-linux-musl -Xswiftc -static-executable
- Observe the warning and error:
warning: multiple Swift SDKs match IDswift-6.2-RELEASE_static-linux-0.0.1
and host triple arm64-apple-macosx26.0
error: could not find module '_Concurrency' for target 'aarch64-swift-linux-musl';
found: x86_64-swift-linux-musl, at: .../x86_64/usr/lib/swift_static/linux-static/_Concurrency.swiftmodule - Run multiple times to observe nondeterministic behavior (sometimes succeeds, sometimes fails with wrong architecture)
Swift Package Manager version/commit hash
No response
Swift & OS version (output of swift --version ; uname -a
)
Swift version: Apple Swift version 6.2 (swift-6.2-RELEASE)
Platform: macOS 26.0.1 (arm64-apple-macosx26.0)
Swift SDK: swift-6.2-RELEASE_static-linux-0.0.1 (multi-arch: x86_64 and aarch64)