Closed arguiot closed 1 year ago
Configure the build with C++ interoperability enabled.
How are you doing this?
In Xcode 15, just go to « Build Settings » and search for interoperability. Just switch to C++/Objective C++.
Another way is to go in Package.swift and use .Cxx
for interoperability.
In other words, for an Xcode project that depends on this package, set the SWIFT_OBJC_INTEROP_MODE
build setting to objcxx
. If the dependent project is a package, add .interoperabilityMode(.Cxx)
to the target's swiftSettings
argument.
These are new in the current prerelease Swift 5.9 builds.
Given that this can only affect Swift 5.9+, the option I like the most is to push the package forward and replace C atomics with native builtins on such toolchains. (Which are now accessible to packages thanks to an "experimental" language feature.)
Thanks for reporting this! It is now resolved on the main
branch of this repository. If you find that the problem is still reproducible on the current main
branch, please reopen this issue.
To verify the fix, you'll need to temporarily update to a commit-based (or branch-based) dependency spec for swift-atomics.
The problem and its solution are both specific to Swift 5.9, so we'll need to wait until 5.9 ships before tagging a new swift-atomics release that includes the fix.
Issue description
When attempting to build the
apple/swift-atomics
library with C++ interoperability enabled, several errors are encountered in the_AtomicsShims.h
header file. These errors prevent the library from being built successfully.Steps to reproduce
apple/swift-atomics
package in a target using SwiftPM.Expected behavior
The library should build successfully with C++ interoperability enabled. The library should correctly detect that C++ inter is enabled instead of blindly assuming that interoperability will be C/Objective-C
Actual behavior
Several errors are encountered in the
_AtomicsShims.h
header file, preventing the library from being built successfully.Error messages
Environment