Skip to content

"InternalError: Unexpected \'-Wwarning\' or \'-Werror\' at the end of args" when building with -Xcc -Werror #9192

@loonatick-src

Description

@loonatick-src

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

We encountered this in one of our CI jobs when upgrading to Swift 6.2.0. This should replicate when running swift build -Xcc -Werror or swift build -Xcc -Wwarning using a Swift 6.2.0 toolchain on any package supporting Swift 6.2.0.

I think this was introduced in here: #8315
Specifically, this filter should probably be applied to reversed args.

Expected behavior

Should build the package with while passing -Werror to the C/CXX compilers successfully, or emit diagnostic information if required.

Actual behavior

Throws an internal error.

error: InternalError(description: "Internal error. Please file a bug at https://github.com/swiftlang/swift-package-manager/issues with this info. Unexpected \'-Wwarning\' or \'-Werror\' at the end of args")
[0/1] Planning build
error: InternalError(description: "Internal error. Please file a bug at https://github.com/swiftlang/swift-package-manager/issues with this info. Unexpected \'-Wwarning\' or \'-Werror\' at the end of args")

Steps to reproduce

On any swift package supporting the Swift 6 toolchain, run swift build -Xcc -Werror or swift build -Xcc Wwarning.

Swift Package Manager version/commit hash

4ffb8cfca658ff8462fba2adfba04013743cf06a

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

Apple Swift version 6.2 (swift-6.2-RELEASE)
Target: arm64-apple-macosx15.0
Build config: +assertions
Darwin PL- Chaitanya Kumar L2K7LPJ7K7 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:52:00 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6031 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