Skip to content

Enabling coverage in release build configuration fails with a -arch specific yet invalid error (SwiftBuild) #9197

@bkhouri

Description

@bkhouri

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

While working on #9162, running swift test with SwiftBuild in release build configuration on a sample package with coverage enabled failed during the phase processing the coverage data with:

error: Unable to export code coverage:
 error: failed to load coverage: '/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Fixtures/Miscellaneous/TestDiscovery/Simple/.build/arm64-apple-macosx/Products/Release/SimpleTests.xctest/Contents/MacOS/SimpleTests': `-arch` specifier is invalid or missing for universal binary
error: could not load coverage information

Expected behavior

Coverage report is produced without any failures.

Actual behavior

The following error occurs:

error: Unable to export code coverage:
 error: failed to load coverage: '/Users/bkhouri/Documents/git/public/swiftlang/swift-package-manager/Fixtures/Miscellaneous/TestDiscovery/Simple/.build/arm64-apple-macosx/Products/Release/SimpleTests.xctest/Contents/MacOS/SimpleTests': `-arch` specifier is invalid or missing for universal binary
error: could not load coverage information

Steps to reproduce

  1. Clone the SwiftPM repository
  2. Build the project with swift build
  3. Run the swift-test executable found in the path returned by swift build --show-bin-path e.g.:
    $(swift build --show-bin-path)/swift-test --package-path Fixtures/Miscellaneous/TestDiscovery/Simple --enable-coverage  --build-system swiftbuild --configuration release 
    

Swift Package Manager version/commit hash

requires #9162 to be merged.

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

❯ swift --version                                 
Apple Swift version 6.2 (swift-6.2-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions

❯ uname -a
Darwin BKs-Work-MBP-M4-Pro.local 25.1.0 Darwin Kernel Version 25.1.0: Mon Sep  8 21:17:17 PDT 2025; root:xnu_development-12377.40.77.505.1~2/DEVELOPMENT_ARM64_T6041 arm64

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions