Build RealmSwift.framework on Xcode 11 beta 4 such that my Swift 5.1-based Realm apps will build. (I assume I still need RealmSwift.framework for my Swift apps?)
Successfully built RealmSwift.framework
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
Undefined symbols for architecture armv7:
"method descriptor for Swift.CustomDebugStringConvertible.debugDescription.getter : Swift.String", referenced from:
protocol conformance descriptor for RealmSwift.RealmPrivileges : Swift.CustomDebugStringConvertible in RealmSwift in Sync.o
protocol conformance descriptor for RealmSwift.ClassPrivileges : Swift.CustomDebugStringConvertible in RealmSwift in Sync.o
protocol conformance descriptor for RealmSwift.ObjectPrivileges : Swift.CustomDebugStringConvertible in RealmSwift in Sync.o
"protocol descriptor for Swift.CustomDebugStringConvertible", referenced from:
protocol conformance descriptor for RealmSwift.RealmPrivileges : Swift.CustomDebugStringConvertible in RealmSwift in Sync.o
protocol conformance descriptor for RealmSwift.ClassPrivileges : Swift.CustomDebugStringConvertible in RealmSwift in Sync.o
protocol conformance descriptor for RealmSwift.ObjectPrivileges : Swift.CustomDebugStringConvertible in RealmSwift in Sync.o
"protocol witness table for __C.NSObject : Foundation._KeyValueCodingAndObserving in Foundation", referenced from:
... (it continues for several pages) ...
DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer ./build.sh ios-swift
(note I can build ios-static and ios-dynamic... just not ios-swift).
Yes, I made sure my Xcode command line version is set to 11.0 (11M374r).
Yes I deleted my DerivedData directory prior to building.
N/A
main branch, SHA1: b2879932ea6e6f1de63e7a70c9ee29658e5870c8
Realm framework version: N/A
Realm Object Server version: N/A
Xcode version: 11 beta 4.
iOS/OSX version: N/A
Dependency manager + version: Directly cloned realm-cocoa, main branch.
I upgraded Xcode 11 to beta 5 today (as it was just released today), and now I can build RealmSwift.xcframework! Closing this issue.
Hey - looks like you forgot to add a T:* label - could you please add one?
I upgraded Xcode 11 to beta 5 today (as it was just released today), and now I can build RealmSwift.xcframework! Closing this issue.
Hey, @smartcat32.
Could you share the Realm code for Xcode 11 beta 5?
It builds alright in Xcode Beta 5 but does it compile in your app yet? @smartcat32
RealmSwift xcframework still throws a can't find realmSwift module error for me, when added to a file.
Yes, you're right. My RealmSwift.xcframework only has an Info.plist in it. After the final * BUILD SUCCEEDED * when building ios-swift, I notice the following:
No 'swiftinterface' files found within '/Users/smartcat32/Projects/Other/realm-cocoa/build/DerivedData/Realm/Build/Products/Release-iphonesimulator/RealmSwift.framework/Modules/RealmSwift.swiftmodule'.
No idea what to do now. I hate my apps being held hostage by Realm much of each summer, but this summer seems much worse because it's unclear what we're even building anymore due to the change to .xcframework. It could be that they're wrapping everything (Realm & RealmSwift for all Apple platforms) into a single Realm.xcframework now (as I believe this can be done, anyways, per the WWDC xcframework talk).
Reopening this ticket. We need some guidance, please, Realm & Mongo devs...
I'm having a similar issue after adding the tg/xcode-11b1 branch to cocoa pods I still got the exception 'Primary key property 'name' does not exist on object 'RealmSwiftPermissionRole'
So I went on to compiling the framework using the build script using the "ios-swift" command. However this didn't work as Xcode threw "/RealmSwift.xcframework/ios-i386_x86_64-simulator/RealmSwift.framework: No such file or directory" or "RealmSwift.xcframework/ios-armv7_arm64/RealmSwift.framework: No such file or directory " (for physical devices)
Any Ideas how to get Realm up and running for iOS 13 and Xcode 11?
@smartcat32 @airlenbauer Have either of you tried Swift PM yet? I have Xcode beta 5 working after using Swift PM, clearing DerivedData, restarting Xcode, and invalidating the Swift PM cache.
@jsflax I've never used the Swift Package Manager yet for anything. I think I heard in WWDC video that it's integrated with Xcode 11 now, but I have not explored it yet. Will go catch up further on the videos, but if you have some instructions for how to build RealmSwift with the PM (or maybe using the PM is more a matter of how to integrate RealmSwift's code into my apps directly?), I'll try it out right away.
@jsflax Swift PM worked! My realm-based iOS app is running in iOS 13! So for anyone who is as lost as I was, here are my steps:
How to switch from using pre-built Realm and RealmSwift frameworks to using Xcode's built-in Package Manager that fetches and builds Realm while building your app (and I have no app extensions so can't speak for those - see another thread here for dealing with those). Xcode 11 beta 5, and with Xcode 11 selected in "Command Line Tools" in Xcode's preferences.
I first removed Realm.framework and RealmSwift.framework (or .xcframework if you've been trying to make those work) from the embedded and linked libraries phases of my app target, and removed the realm path from my target's Framework Search Paths in build settings. I also removed the build phase that runs a script to strip the realm frameworks. I then quit Xcode 11 and deleted my DerivedData. I then followed the instructions of this article: Add Swift Package Dependency to an iOS Project With Xcode 11, only in the step named "Fetching a Custom Repository" I pasted in: https://github.com/realm/realm-cocoa . Then in the package options step I chose "3.17.3" and "Exact" (for now).
That's it! I now have a Realm and RealmSwift embedded in my app, built automatically from the repo, targeting the Realm version I want. I've always been a disbeliever of Cocopods and other package managers in the past... never liked the idea of them messing around in my Xcode projects. But Apple managing it is a whole different ball game. Sold! Thanks @jsflax !!
I suppose this ticket should stay open for whoever has a situation that requires manually building the frameworks, but I recommend my fellow package-manage-adverse devs give this a shot!
@smartcat32 , @jsflax: I got it working using Swift Package Manager as in your comment but now I get the following build error when building the UI tests target and I can not figure out what's the problem:
in collection_change_builder.hpp:24:10: fatal error: 'realm/util/optional.hpp' file not found
#include <realm/util/optional.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~
Do you have the same problem?
@bmunkholm Maybe the issue should be reopen?
Similar to @damianpop but different source when building target Realm
in execution_context_id.hpp:32:10: fatal error: 'realm/util/assert.hpp' file not found
Xcode 11 beta 5
@damianpop @bmalbuck I have 3 types of tests in my app: unit tests (including view model testing and has heavy use of Realm), VC tests (where I stand up a UIViewController independently of the rest of the app and test its functionality especially its side of the MVVM protocol contract - shouldn't ever call into Realm but I seem to have a Realm dependency anyways when building), and UI tests (which I use very sparingly as I find full app UI testing far too fragile).
I have all three of these test targets building and executing in Xcode 11 beta 5 and where my app's target uses Realm's SPM as discussed above in this thread, but to do so I had to add Realm and RealmSwift to the unit tests target and to the vc tests target (not the UI tests target). By "add", I mean add to the Link Binary with Libraries build phase of those targets. I haven't seen any fatal errors. Hope this helps! Note all three of my test targets specify a host (or target) application in the General tab, to be my app target, so none of my test targets directly link to anything (except now to Realm and RealmSwift as provided by the SPM).
Hope this helps! You can find me on ios-developers Slack as smartcat if anyone wants to discuss in more depth.
Very strangely I added the Realm and RealmSwift to the UI tests target (Link Binary with Libraries build phase) and the errors are gone.
My issue (see comment above) building Realm...
execution_context_id.hpp:32:10: fatal error: 'realm/util/assert.hpp' file not found
happens when building for watchOS 6.0 simulator. Build succeeds for iOS 13.0 simulator. I'll have to dig deeper as to why it won't build for watchOS platform but if anyone has a solution/idea please post. I've seen issues like these before using parallelized builds and have resolved using the old build system but that's not going to work for Swift PM.
For context, I am attempting to use Swift PM for RealmSwift in an iOS project with a watchOS app extension. Both platforms require Realm during execution so Realm needs to be build for both platforms. The project, now using SwiftPM, seems to understand this and proceeds to build dependencies first. In this case, RealmCore Realm for watchOS. If I temporarily remove the watch extension dependency, Realm builds for iOS.
Having the same issue as @bmalbuck ; when using Swift Package Manager with Independent watchOS apps, "compiled with the iOS app". This issue should be reopened.
Thanks for sharing @virtuosovidit seems we have reproduce cases for building Realm on watchOS 6.0. This issue should be reopened or maybe a separate issue/ticket specific for watchOS. cc @jsflax
@virtuosovidit @bmalbuck We would appreciate a new specific issue with all details, and preferable a minimal repro-case that would be gold. Please detail your setup and how to reproduce and what you tried to debug. Thanks!
@bmunkholm @virtuosovidit
see https://github.com/realm/realm-cocoa/issues/6226#issue-479385164
Most helpful comment
@smartcat32 , @jsflax: I got it working using Swift Package Manager as in your comment but now I get the following build error when building the UI tests target and I can not figure out what's the problem:
Do you have the same problem?
@bmunkholm Maybe the issue should be reopen?