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

Carthage doesn't catch frameworks built with a newer swift version. #3353

Open
CraigSiemens opened this issue Sep 18, 2023 · 1 comment
Open

Comments

@CraigSiemens
Copy link

CraigSiemens commented Sep 18, 2023

  • carthage install method: [ ] .pkg, [x] homebrew, [ ] source
  • which carthage: /opt/homebrew/bin/carthage
  • carthage version: 0.39.0
  • xcodebuild -version: Xcode 14.2 Build version 14C18
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No
  • Are you using --cache-builds? No
  • Are you using --new-resolver? No
  • Are you using --use-xcframeworks? Yes

Cartfile

github "Quick/Quick"
github "Quick/Nimble"

Carthage Output

*** xcodebuild output can be found in /var/folders/0x/xmj5lbp51b95_37jrhhbfskh0000gn/T/carthage-xcodebuild.9VvEFn.log
*** Downloading Nimble binary at "v12.3.0"
*** Downloading Quick binary at "v7.3.0"
***  Skipped installing Nimble binary due to the error:
	"Incompatible Swift version - framework was built with 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100) and the local version is 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)."

    Falling back to building from the source
*** Building scheme "Nimble-iOS" in Nimble.xcodeproj

Actual outcome
Carthage downloaded and used the Quick.xcframework since it appears to pass the checkSwiftFrameworkCompatibility but when Xcode builds the project it fails with the following error.

failed to build module 'Quick'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a toolchain which matches the SDK.

Expected outcome
Carthage should detect that the Quick framework is not compatible and build it from source like it does for the Nimble framework.

I believe it's caused by the framework being built with a newer version of swift which cannot be used by older versions, even if BUILD_LIBRARY_FOR_DISTRIBUTION is used by the framework.

I tried some quick debugging and it appears that Nimble is only caught because the watchOS framework is missing the .swiftinterface file. If that was present, it wouldn't be built and Xcode would fail with the same error.

@jdhealy
Copy link
Member

jdhealy commented Sep 18, 2023

Thanks for putting this report together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants