Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library evolution support is broken #242

Closed
ugomarinelli opened this issue Dec 16, 2021 · 2 comments · Fixed by #245 or #265
Closed

Library evolution support is broken #242

ugomarinelli opened this issue Dec 16, 2021 · 2 comments · Fixed by #245 or #265
Labels
reproducible It’s not just you; we see it too! swift bug Linked to an issue on bugs.swift.org

Comments

@ugomarinelli
Copy link

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 !

@andrewchang-bird
Copy link
Contributor

andrewchang-bird commented Dec 21, 2021

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?

@andrewchang-bird andrewchang-bird changed the title Support for XCode 13.2 Library evolution support is broken Jan 9, 2022
@andrewchang-bird
Copy link
Contributor

andrewchang-bird commented Jan 9, 2022

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.

@andrewchang-bird andrewchang-bird added reproducible It’s not just you; we see it too! swift bug Linked to an issue on bugs.swift.org labels Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reproducible It’s not just you; we see it too! swift bug Linked to an issue on bugs.swift.org
Projects
None yet
2 participants