-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ld: framework not found Realm for architecture x86_64 in react-native iOS project with Realmjs installed #5233
Comments
Is it because in react-native, I have installed realm-js.
But after I have react-native unlink realm, it still same error. Sorry, I have forget something else, when I add libc++.tbd, and libz.tbd at Build Phases -> Link Binary With Libraries in the library, Realm.framework as docs said, it gave me this error:
And if I only use libc++.tbd, and libz.tbd without Realm.framework. no such errors. Those files both located in iPhoneOS.platform indeed. And then I removed both of them, it gave me the error above. |
Can you pleas share the actual linker error that you're seeing? It is available via the Report navigator (View -> Navigators -> Show Report Navigator) then clicking on the failing build. It will provide details that will help understand what's going wrong. My initial suspicion is that the Realm framework isn't in a directory that is on the framework search path. |
I hope that is the case, there are some pics to show my steps:
And I did use 'show Finder' to check: So it's right in that folder. What I did, was to unzip the Then I will drag it to the library project here: Then Realm.framework seems added correctly: The code is simple, just try to show if it worked: And then when I run it, got a link error. Could it be some kind conflict with Realm-js in this react-native project? Or I didn't see any error in a new iOS project I created. |
More specific:
Then I run it, very good!! In react native based iOS project, it already include the libc++.tbd and libz.tbd at app scope, so it won't able to add libc++.tbd and libz.tbd to the library without error. If I added libc++.tbd and libz.tbd in library scope, and it will tell me:
So in the static library sample, only added Realm.framework, it won't show any error to compile it though, only link error above. |
Rather than taking a screenshot of a subset of the error message, can you please click on the heading above it (the |
Certainly, here it is: Build logShowing Recent Issues Ld /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/weishangjizhang.app/weishangjizhang normal x86_64 cd /Volumes/DOS/work.current/wjz/ios export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator -F/Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator -filelist /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/Objects-normal/x86_64/weishangjizhang.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=8.0 -Xlinker -object_path_lto -Xlinker /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/Objects-normal/x86_64/weishangjizhang_lto.o -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lc++ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/weishangjizhang.app.xcent /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libReact.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTAnimation.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTActionSheet.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTGeolocation.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTImage.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTLinking.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTNetwork.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTSettings.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTText.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTVibration.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a -lRNVectorIcons -lRealmReact -lHanziToPinyin -lRNFS -lRCTCamera -lRCTToast -Xlinker -dependency_info -Xlinker /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/Objects-normal/x86_64/weishangjizhang_dependency_info.dat -o /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/weishangjizhang.app/weishangjizhang |
I'm a little confused by that output for a few reasons:
My guess is that your project is structured so that you have a static library target that is using Realm, and then an application target that links in the static library target. The static library target is configured with the appropriate search path and linker settings to link against the Realm framework, but the application target isn't. Due to the way that static libraries work, there's no link phase and so attempting to link your static library against the static Realm framework doesn't achieve anything. What you'd need to do instead is configure your final application target to link against Realm. |
Thank you. You probably right, I am going to figure out how. |
Sorry, another problem, this time I linked the Realm.framework at application target as well, and it show conflict with libRealmReact: Build logShowing Recent Issues Ld /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/weishangjizhang.app/weishangjizhang normal x86_64 cd /Volumes/DOS/work.current/wjz/ios export IPHONEOS_DEPLOYMENT_TARGET=8.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator -F/Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator -F/Volumes/DOS -filelist /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/Objects-normal/x86_64/weishangjizhang.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=8.0 -Xlinker -object_path_lto -Xlinker /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/Objects-normal/x86_64/weishangjizhang_lto.o -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lc++ -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/weishangjizhang.app.xcent /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libReact.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTAnimation.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTActionSheet.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTGeolocation.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTImage.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTLinking.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTNetwork.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTSettings.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTText.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTVibration.a /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a -lRNVectorIcons -lRealmReact -lc++ -lz -lHanziToPinyin -lRNFS -lRCTCamera -lRCTToast -framework Realm -Xlinker -dependency_info -Xlinker /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Intermediates/weishangjizhang.build/Debug-iphonesimulator/weishangjizhang.build/Objects-normal/x86_64/weishangjizhang_dependency_info.dat -o /Users/hello/Library/Developer/Xcode/DerivedData/weishangjizhang-grrzureurwytuzaclurmtgiqnxgq/Build/Products/Debug-iphonesimulator/weishangjizhang.app/weishangjizhang |
That's not a particularly surprising outcome. Both Realm JS and Realm Objective-C include common code. Linking both of them into the same image will result in duplicate symbols. You'd need to isolate one or both of them in a shared library. The simplest way to accomplish that would be to use the dynamic Realm framework. Not that you'll need to be very careful to ensure that the versions of Realm JS and Realm Objective-C are using the same versions of the underlying Realm Core library. Even then, you may see surprising behavior because the scenario of embedding multiple copies of Realm in the same process is not tested nor officially supported. |
I see, I hope this can be supported some time, so it's able to access the Realm db in native side from react-native, will promote the performance of the app, I will address this suggestion in Realm-js as well, thank you very much for your help. |
Goals
To use Realm.framework at Cocoa Touch Static Library
Expected Results
Compile and run successfully
Actual Results
I have got:
Steps to Reproduce
Code Sample
Version of Realm and Tooling
Realm framework version: ?
0.29.1
Realm Object Server version: ?
None
Xcode version: ?
8.3.2
iOS/OSX version: ?
10.3/10.12.6
Dependency manager + version: ?
The text was updated successfully, but these errors were encountered: