realm-js: [Bug report] Undefined symbols for architecture x86_64 on Xcode build
Goals
We are getting several errors Undefined symbols for architecture x86_64
when try to build (play) the React Native app with Xcode for iOS.
Here I report the example of two apps, with two different versions of Realm and React Native, both with the same problem.
To solve, we need to:
cd ios
rm -rf Pods
pod install
This happens several times a day, we have not yet discovered the reason.
My guess is that this is related to branch exchange. However, when changing branches, neither React Native nor Realm versions are changed. (ios/Pods
and node_modules
are ignored on GIT)
React Native 0.62.2 and RealmJS 6.0.2
React Native 0.61.5 and RealmJS 3.6.5
Steps to Reproduce
Unfortunately, we still haven’t found a standard behavior.
As @somebody32 says here https://github.com/realm/realm-js/issues/3221#issuecomment-723875769
Looks like it is happening every time there is a change in Pods (ie adding a new or upgrading a version of any pod, not Realm). Realm is 10.0.1.
The temporal solution is to clean the build and do pod install again (no need to remove pods or node_modules folder), but I agree that it is pretty time consuming
Code Sample
Both projects are created using react-native init
, without any customization in the metro
, babel
or{{ cocoapods}} scripts.
Version of Realm and Tooling
- Realm JS SDK Version: 3.6.5 and 6.0.2
- React Native: RN 0.61.5 and 0.62.2 both with cocoapods and autolinking
- Cocoapods: 1.9.3
- Xcode: 11.7 (11E801a)
- Node: 12.16.3 with nvm
- Client OS & Version: macOS Catalina 10.15.6 (19G2021)
- Which debugger for React Native: None
Maybe related to https://github.com/realm/realm-js/issues/2271 https://github.com/realm/realm-cocoa/issues/2393
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 19
- Comments: 31 (5 by maintainers)
Looks like it is happening every time there is a change in Pods (ie adding a new or upgrading a version of any pod, not Realm). Realm is 10.0.1.
The temporal solution is to clean the build and do pod install again (no need to remove pods or node_modules folder), but I agree that it is pretty time consuming
You can add something like
to your app’s pod. See also https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios
Why it is closed? Reinstall pods take time that is unnecessary. Need to find issue that cause crash on build
I’ve also been encountering this same problem for months now. Been happening on Realm V3, V6 and now V10, so it’s definitely not something caused by some recent change. My solution has been the same, clean build, reinstall pods, but it’s more time-consuming than it needs to be, since it happens every time I need to Pod Install, even if Realm itself doesn’t change.
I wrote some hack for solve this issue for me for a while We need clear build folder and pods, as @douglasjunior says. So, we can do it in
postinstall
stepbin/postInstall
package.json
After this, I run project directly from XCode 12 and build success. This solution is not brilliant, but solve the issue
@whalemare We have updated our library to be built with a precompiled xcframework, which should prevent such crashes from occurring and also result in much faster builds. Which version of Realm are you using? Can you verify what steps you are taking to cause the crash?
Here we just need to:
No project clean, no cache clean, just reinstall pods, close and open Xcode, build.
The most performant solution is to remove single Pod:
When you clean build, reinstall pods (pod deintegrate, rm -rf ~/Library/Caches/CocoaPods, rm -rf Pods) - then it takes much more time for new build.
I just went in a day from 10 min debug/release build to 3 min release build and 2 min debug build by fixing this and removing Flipper from my project 😃 so I’m happy 😃
This fixes the issue I had with Xcode randomly showing 100 errors and stopping in the last 1%. I hope it helps someone 😃
I also posted here, maybe related … https://github.com/realm/realm-cocoa/issues/6069#issuecomment-770220016
Yes, as I said, removing the Pods folder and installing again temporarily resolves the issue.
But, we still don’t know the reason, the problem appears again, in different projects, different versions, different machines.