Skip to content

swift build --triple does not affect build target #8716

@krzyzanowskim

Description

@krzyzanowskim

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

Triple specified with the "triple" argument is not picked up by build:

swift build --triple arm64-apple-macosx15.0
Target: arm64-apple-macosx10.13

and specify target triple for swiftc is picked up by build

swift build -Xswiftc -target -Xswiftc arm64-apple-macosx15.0
Target: arm64-apple-macosx15.0

Expected behavior

swift build --triple triple-value override/set Package manifest platform target triple

Actual behavior

--triple value is ignored

Steps to reproduce

on macOS, build simple package with minimum manifest

// swift-tools-version:5.9
import PackageDescription

let package = Package(
    name: "Foo",
    products: [
        .executable(
            name: "Foo",
            targets: ["Foo"]),
    ],
    dependencies: [],
    targets: [
        .executableTarget(
            name: "Foo",
            dependencies: []),
    ]
)
swift build --triple arm64-apple-macosx15.0 -v
Target: arm64-apple-macosx10.13

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.1.0

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0
Darwin MarcinK-MacBook.local 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:33 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8122 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions