Library evolution support is broken
ugomarinelli opened this issue · comments
Hello,
We are currently blocked when using XCode 13.2, with this message:
Failed to build module 'Mockingbird'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)', while this compiler is 'Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)'). Please select a toolchain which matches the SDK
.
Do you have any plans to support XCode 13.2 in the future ?
Thank you !
Thanks for filing. Which package manager are you using? If you build the framework from source or via SPM does it still raise this error?
So the issue is that library evolution / module stability isn’t working even though it’s enabled for the framework; BUILD_LIBRARY_FOR_DISTRIBUTION
is explicitly set to YES
and a Swift module interface is being generated with -enable-library-evolution
listed in the module flags. Seems like it might be something with how Swift is doing library evolution as there are known problems (realm/realm-swift#7313).
In the meantime, you should build the framework from source. If you’re using Carthage, you’ll need to run carthage build
whenever changing Xcode toolchains / Swift versions.
Edit: After additional investigation, it’s due to a known issue since Xcode 11.2:
If a module is built with
BUILD_LIBRARIES_FOR_DISTRIBUTION
and contains a public type with the same name as the module itself, clients will fail to import the module. (19481048) (FB5863238)Workaround: Rename either the type or the module to remove the conflict.
Specifically, Mockingbird returns an XCTest.XCTestExpectation
for asynchronous testing which is ambiguous since XCTest
itself exports a class named XCTest
... It might be worth a breaking API change to unblock module stability, but there doesn’t seem to be an easy path forward for now.