swift-atomics icon indicating copy to clipboard operation
swift-atomics copied to clipboard

Swift atomics fails to compile running `xcodebuild` with `OTHER_SWIFT_FLAGS`

Open winston-riley-zocdoc opened this issue 1 year ago • 0 comments

Problem

Swift atomics fails to compile running xcodebuild with OTHER_SWIFT_FLAGS.

For example:

$ xcodebuild build OTHER_SWIFT_FLAGS="-suppress-warnings"
...
<SNIP>/Sources/Atomics/Conformances/autogenerated/AtomicBool.swift:22:8: error: no such module 'Builtin'
import Builtin
       ^

** BUILD FAILED **


The following build commands failed:
	CompileSwift normal arm64 (in target 'Atomics' from project 'swift-atomics')
...

However removing OTHER_SWIFT_FLAGS succeeds, the target depending on swift-atomics compiles successfully.

The following command works:

$ xcodebuild build
...
** BUILD SUCCEEDED **

FWIW, any value for OTHER_SWIFT_FLAGS fails in the above way. For example xcodebuild build OTHER_SWIFT_FLAGS="baz" also fails.

Information

$ xcodebuild -version
Xcode 15.1
Build version 15C65

$ swift -version 
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)

Resolved source packages:
  swift-atomics: https://github.com/apple/swift-atomics.git @ 1.2.0

Checklist

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

Steps to Reproduce

  1. Using the above version of Xcode create a new iOS app project
  2. Add swift atomics as a dependancy (File > Add Package Dependencies > swift-atomics)
  3. Run xcodebuild build OTHER_SWIFT_FLAGS="-suppress-warnings" 💥 , get the above error.

Expected behavior

Project compiles

Actual behavior

Project fails to compile with the following error:

<SNIP>/Sources/Atomics/Conformances/autogenerated/AtomicBool.swift:22:8: error: no such module 'Builtin'
import Builtin
       ^

** BUILD FAILED **


The following build commands failed:
	CompileSwift normal arm64 (in target 'Atomics' from project 'swift-atomics')

Thanks in advance for any help.

winston-riley-zocdoc avatar Dec 29 '23 14:12 winston-riley-zocdoc