Skip to content

xcodebuild archive fails with swift-atomics when BUILD_LIBRARY_FOR_DISTRIBUTION=YES due to missing _AtomicsShims module #121

@fearless-taco

Description

@fearless-taco

When using swift-atomics (v1.0.0, 1.1.0, or 1.3.0) as a dependency in a Swift framework with BUILD_LIBRARY_FOR_DISTRIBUTION=YES, xcodebuild archive fails due to _AtomicsShims being referenced in the generated .swiftinterface, but not available at validation time.

This was discovered originally using 1.2, then detecting the a breaking change in 1.3. I tested backwards compatibility and found the issue exists on 1.0 and 1.1 as well.

✅ Works when:
• BUILD_LIBRARY_FOR_DISTRIBUTION=NO
• Using version 1.2.0 of the package
• Archiving inside the Xcode UI

❌ Fails when:
• Using CLI (xcodebuild archive) with library evolution enabled

Information

  • Package version: 1.3.0 (also fails on 1.0.0 and 1.1.0; only 1.2.0 works)
  • Platform version: macOS Sequoia 15.4.1
  • Swift version:
    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

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • I've searched for existing reports of the same issue.

Steps to Reproduce

  1. Create an Xcode Project with an App
  2. Add Swift Atomics as a Package Dependency
  3. For the App target, add the Framework under 'Frameworks, Libraries, & Embedded Content'
  4. Run command xcodebuild archive with BUILD_LIBRARY_FOR_DISTRIBUTION=YES
xcodebuild archive -scheme App -configuration Release -archivePath output/App.xcarchive -sdk iphoneos BUILD_LIBRARY_FOR_DISTRIBUTION=YES

Expected behavior

The framework should archive successfully, as it does with version 1.2.0 of swift-atomics.

Actual behavior

The archive operation fails with the following errors:

 7 | import _AtomicsShims     
   |        `- error: no such module '_AtomicsShims'
 1 | // swift-interface-format-version: 1.0 
   | `- error: failed to verify module interface of 'Atomics' due to the errors above; the textual interface may be broken by project issues or a compiler bug
SwiftDriverJobDiscovery normal arm64 Compiling OptionalRawRepresentable.swift, RawRepresentable.swift, AtomicBool.swift, ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions