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

Error building Realm with Carthage on Swift 4 #5070

Closed
luispadron opened this issue Jun 26, 2017 · 5 comments
Closed

Error building Realm with Carthage on Swift 4 #5070

luispadron opened this issue Jun 26, 2017 · 5 comments
Labels

Comments

@luispadron
Copy link

luispadron commented Jun 26, 2017

Goals

Build Realm with Carthage

Expected Results

Normal carthage build folder is generated with no errors

Actual Results

Error when building Realm with Carthage

Steps to Reproduce

Run carthage update with realm as dependency in a Swift 4 xcode project.

Code Sample

 carthage update --platform iOS
*** Fetching realm-cocoa
*** Downloading realm-cocoa.framework binary at "v2.8.3"
*** Skipped installing realm-cocoa.framework binary due to the error:
	"Incompatible Swift version - framework was built with 3.1 and the local version is 4.0."

Not really familiar with Carthage or how it decides which swift version to use. However, I have used other dependencies (my own, which I've updated to Swift 4) and this doesn't seem to be an issue. Is this just a problem with Realm not being fully built for Swift 4 yet or a carthage issue?

Version of Realm and Tooling

Realm framework version: 2.8.3

Xcode version: 9 beta 2

iOS/OSX version: iOS 11.0

Dependency manager + version: Carthage 0.23.0

@edwinveger
Copy link

As far as I know, Xcode 9 packs an updated compiler which can compile 3.2 and 4.0. When an Xcode project/target does not explicitly require version 4, version 3.2 is inferred (which is a kind of compatibility version with very little changes from 3.1).
However, the binary that Carthage downloads for the latest release matching your Cartfile is compiled with 3.1 and does not satisfy the requirements (since you've selected the 9.0 beta command line tools). After this, Carthage should try to build the framework itself.
I expect that when Xcode 9 GM is released a Swift 3.2/4 binary will be available for RealmSwift.

@tgoyne
Copy link
Member

tgoyne commented Jun 26, 2017

To use Realm with Xcode 9 you must build it from source with Xcode 9. This can be done with Carthage with DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer carthage bootstrap --no-use-binaries

@luispadron
Copy link
Author

luispadron commented Jun 26, 2017

As @tgoyne said, this seems to have worked and it built Realm correctly. However getting segementation faults after adding the frameworks to my project. Swift 4 compiler is just really unstable...

// Causing nonsensical segfault inside a file which imports RealmSwift
error: 'id' used within its own type
    @objc dynamic var id = UUID().uuidString
                      ^
error: could not infer type for 'id'
    @objc dynamic var id = UUID().uuidString
                      ^
error: use of undeclared type 'Date'
    convenience init(name: String, date: Date, score: Double, associatedRubric: Rubric) {

I guess it's just a matter of waiting until this gets resolved by the swift team or wait for Xcode 9 GM, because I've been using Realm with CocoaPods but was having a segfault and loss of highliting every 2 lines of code. Thought maybe using Carthage would help, but it seems to not be working at all...

@austinzheng
Copy link
Contributor

If you experience issues with the Swift compiler crashing, please feel free to create minimal reproduction cases and submit them to the Swift JIRA at https://bugs.swift.org.

@armandzwan
Copy link

You could try installing the latest Swift build.
https://swift.org/download/#snapshots

It worked for me!

@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

6 participants