Skip to content

SPM Build for Android fails with --build-system swiftbuild: module not found due to target triple mismatch #1167

@NikolayJuly

Description

@NikolayJuly

When building a Swift package for Android using --build-system swiftbuild, the build fails because the Android API level is stripped from the target triple during module lookup.

The compiler searches for a module targeting aarch64-unknown-linux-android but only finds one compiled for aarch64-unknown-linux-android28.0.0. The default build system handles this correctly.

Reproduction

Works (default build system):

swiftly run swift build --product LoggingExtensionDynamic --swift-sdk aarch64-unknown-linux-android28 +main-snapshot-2026-03-02

Fails (swiftbuild):

swiftly run swift build --product LoggingExtensionDynamic --swift-sdk aarch64-unknown-linux-android28 --build-system swiftbuild +main-snapshot-2026-03-02

Error

could not find module 'Logging' for target 'aarch64-unknown-linux-android';
found: aarch64-unknown-linux-android28.0.0

Full verbose output: ErrorOutput.txt

Sample package

Minimal reproduction with 1 target and 1 file: FoundationExtension.zip

Environment

Reproduced on both configurations:

Toolchain Android SDK API level
1 Swift 6.2.3 (swift-6.2.3-RELEASE), arm64-apple-macosx15.0 finagolfin/swift-android-sdk 24
2 Swift 6.3-dev (LLVM c483661d4d6aac5, Swift 34b17dd3e44b2a6), arm64-apple-macosx26.0, +assertions Official swift.org nightly (main-snapshot-2026-03-02) 28

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