Realm-cocoa: Cannot build Realm by using Carthage on XCode 7.3 final

Created on 23 Mar 2016  路  4Comments  路  Source: realm/realm-cocoa

Hello,
I'm trying to build Realm Lib from carthage but this problem happen.
Please spend your time to investigate it.
Error:(7, 8) module file was created by an older version of the compiler; rebuild 'RealmSwift' and try again: /Users/myname/Workspace/project/Carthage/Build/iOS/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule

Xcode 7.3
Carthage latest version

Thanks,

T-Help

Most helpful comment

Xcode 7.3 introduced the Swift 2.2 compiler, while the frameworks distributed by Carthage are built with Swift 2.1.

As a temporary workaround, you can build the framweworks from source manually with Swift 2.2:

$ git clone https://github.com/realm/realm-cocoa.git
$ cd realm-cocoa/
$ git checkout v0.98.5
$ REALM_SWIFT_VERSION=2.2 sh build.sh build

and replace the ones installed by Carthage:

$ cp build/ios/swift-2.2/Realm.framework [YOUR PROJECT]/Carthage/Build/iOS
$ cp build/ios/swift-2.2/RealmSwift.framework [YOUR PROJECT]/Carthage/Build/iOS

All 4 comments

Xcode 7.3 introduced the Swift 2.2 compiler, while the frameworks distributed by Carthage are built with Swift 2.1.

As a temporary workaround, you can build the framweworks from source manually with Swift 2.2:

$ git clone https://github.com/realm/realm-cocoa.git
$ cd realm-cocoa/
$ git checkout v0.98.5
$ REALM_SWIFT_VERSION=2.2 sh build.sh build

and replace the ones installed by Carthage:

$ cp build/ios/swift-2.2/Realm.framework [YOUR PROJECT]/Carthage/Build/iOS
$ cp build/ios/swift-2.2/RealmSwift.framework [YOUR PROJECT]/Carthage/Build/iOS

@jpsim's comment in #3355 goes into why you're seeing this error, and what you can do to work around it. It boils down to having Carthage build Realm from source rather than using pre-built binaries, as pre-built binaries of Swift frameworks require that you're using the same version of Xcode that a Realm release was built with.

thanks @antfarm , it worked.

We have just released Realm Swift v0.98.6, built with Xcode 7.3, to address this issue.

Was this page helpful?
0 / 5 - 0 ratings