12

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!

alexmngn
  • 7,551
  • 14
  • 57
  • 117

4 Answers4

10

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

  • disable bitcode for development (that is where flipper exists)
  • make sure you have dead code stripping turned on everywhere
  • enable bitcode for release mode

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!

Mike Hardy
  • 1,148
  • 2
  • 9
  • 29
  • Disabling bitcode for Debug mode triggers all kinds of Swift problems. I have 15 additional issues when I put it to No. But having it on Yes, I only have only the one issue described above. – Benjamin Heinke May 09 '20 at 18:05
  • 2
    Hi there. There are workarounds on other issues plus an install guide that instruct you to make a dummy Swift bridging header *and leave it in place*. This is also recommended https://fbflipper.com/docs/troubleshooting#build-errors-in-react-native - please note that I discussed this in the react-native-firebase issue tracker and the problem was ultimately resolved to these errors, and fixed - so it's a little hacky but it does work. https://github.com/invertase/react-native-firebase/issues/3384#issuecomment-626345098 – Mike Hardy May 10 '20 at 19:14
  • @MikeHardy thank you. This workaround still works for **RN 0.63.4** and **XCode 12.4** – Christos Lytras Feb 01 '21 at 18:34
2

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:

  1. comment all Flipper's lines in your pod file and in AppDelegate.m file.
  2. remove yarn.lock file and pods folder
  3. run pod install again.

After these steps all will work.

Max
  • 701
  • 5
  • 13
-1

clean the project and then run, the libraries were compiled for the simulator and duplicates were created for the device

Lena Bru
  • 12,299
  • 9
  • 53
  • 109
-1

Like you mentioned it is due to multiple generated files, one thing you can do is clean the entire folder and before running it restart the computer and xcode .Also Clear the derived data folder for Xcode. and Rebuild it, delete any older versions of the RN APP in your "Mobile Device" the caches could also provide this . Also hoping you did not change the target name recently?

Anjula S.
  • 586
  • 5
  • 17