For some reason since recently, I cannot run my React Native app on a physical device from Xcode or even from the command line. I'm getting the following error:
duplicate symbol '_md5_block_data_order' in:
/XXX/Library/Developer/Xcode/DerivedData/XXXX-bdrylwsxpcqgzvgkcljteyttcdmr/Build/Products/Debug-iphoneos/BoringSSL-GRPC/libBoringSSL-GRPC.a(md5.o)
/XXX/project/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(md5_dgst.o)
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
However it works fine from a simulator. And I can upload the app to AppStoreConnect without any issue.
From what I understand it looks like the same symbol exists in 2 libraries. Not sure why, most likely one of the mobile app dependencies.
In the list of Pods installed I have both BoringSSL-GRPC (0.0.3)
and OpenSSL-Universal (1.0.2.19)
BoringSSL is used by Firebase and OpenSSL is used by Flipper.
This is the list of third party dependencies I use:
pod 'Firebase/Core', '~> 6.3.0'
pod 'Firebase/Messaging', '~> 6.3.0'
pod 'Firebase/Firestore', '~> 6.3.0'
pod 'Firebase/Auth', '~> 6.3.0'
pod 'TrustKit'
pod 'Stripe', '16.0.0'
pod 'Amplitude-iOS', '~> 4.5'
pod 'Intercom', '~> 5.5.1'
flipper_pods()
When I remove Firebase all together, it works fine and I can run my app on the device. But I need Firebase...
Any idea how to resolve this?
Thanks!
The first thing to do is to connect your iOS device to your Mac with a USB cable. Open your react native app's directory, navigate to ios folder, and double-click on . xcworkspace file to open the Xcode. Next, open the Product menu, go to Destination, and select your device.
Once you have your React Native project initialized, you can run npx react-native run-ios inside the newly created project directory. If everything is set up correctly, you should see your new app running in the iOS Simulator shortly.
With React Native, developers can write real, natively rendering mobile applications for iOS and Android. It helps build apps on two platforms at once, while maintaining the look, feel, and productivity of an app built on the specific iOS or Android platform.
I had the same issue for latest RN and firebase modules. There is PR https://github.com/facebook/flipper/pull/1171 in the flipper, that will fix this issue, but it is still not merged to master, and it seems that 1.0.2.19 version is used for OpenSSL.
So to run your app in real devices I just disabled Flipper. To do it you need to:
After these steps all will work.
This is a problem others are noticing as well https://github.com/invertase/react-native-firebase/issues/3384
The symptoms most are seeing look like:
Pods/OpenSSL-Universal/ios/lib/libcrypto.a(bio_lib.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
There is an upstream issue logged here https://github.com/facebook/flipper/issues/485 that was closed before it became clear it would be a bigger problem than expected.
I tested a workaround which is sub-optimal but functional for now until an OpenSSL library with bitcode is available in the transitive dependencies - the workaround is
In my experience this worked for debug builds on local devices (where it failed before) and a TestFlight build in release mode worked
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With