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 update/bootstrap download Swift 3.1 RealmSwift module for swift 4 #5384

Closed
liuxuan30 opened this issue Oct 9, 2017 · 5 comments
Closed
Labels

Comments

@liuxuan30
Copy link

liuxuan30 commented Oct 9, 2017

I updated ChartsRealm(https://github.com/danielgindi/ChartsRealm) dependency finally, carthage update works fine, downloaded Realm 2.10.2 as expected. However when building ChartsRealm demo, Xcode9 complains

~/ChartsRealm/ChartsRealm/Classes/Data/RealmBarDataSet.swift:16:8: Module compiled with Swift 3.1 cannot be imported in Swift 4.0: ~/ChartsRealm/Carthage/Build/iOS/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule

I then delete carthage folder and run carthage bootstrap again, showing build successful but still the same error. It looks like a wrong module is downloaded. How do we correct it? (build both for arm and x86 arch are the same error)

Carthage output log:

xuanliu:ChartsRealm xuanliu$ carthage bootstrap
*** Checking out Charts at "v3.0.4"
*** Downloading realm-cocoa.framework binary at "v2.10.2"
*** xcodebuild output can be found in /var/folders/8v/6dg7d6mx2850sv1gp8ts9thm0000gn/T/carthage-xcodebuild.HDBArl.log
*** Building scheme "Charts" in Charts.xcodeproj

xuanliu:ChartsRealm xuanliu$ 

Realm framework version: 2.10.2

Xcode version: 9

iOS/OSX version: 11

Dependency manager + version: carthage 0.17.2

@bdash
Copy link
Contributor

bdash commented Oct 14, 2017

The output you've shared indicates that you're using Xcode 9 to when building, but your currently active command-line tools are from an older version of Xcode (Xcode 8.3.x). You need to use the same Xcode version for both to ensure that Carthage gives you frameworks built for the appropriate Swift version.

You can run xcode-select -p to verify which command-line tools are active, and you can use sudo xcode-select -s /path/to/Xcode.app to switch the active tools.

@bdash bdash added the T-Help label Oct 14, 2017
@liuxuan30
Copy link
Author

What? I only have Xcode9 installed..

xuanliu:script xuanliu$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

This can also confirm. But shall I point to just Xcode.app or keep Xcode.app/Contents/Developer?

@bdash
Copy link
Contributor

bdash commented Oct 17, 2017

It’s also possible the issue is that the version of Carthage you’re using predates detecting that prebuilt binaries were built with a different Swift version. v0.17.2 is far behind the most recent version of Carthage, which I think is currently v0.26.2. Can you try updating to a recent version of Carthage?

@bdash
Copy link
Contributor

bdash commented Oct 17, 2017

v0.20.0 or newer of Carthage has the support for falling back to building from source if the prebuilt binaries are built with a different version of Xcode than you’re using locally.

@liuxuan30
Copy link
Author

oh yeah, thanks for pointing this out! I don't realize it's a feature of carthage

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants