React-native-firebase: iOS build fails on real devices with React Native 0.62

Created on 1 Apr 2020  ·  34Comments  ·  Source: invertase/react-native-firebase

I appreciate the official RN recommended version is 0.61 but I though worth flagging that an upgrade to 0.62 breaks iOS build for real devices as per this issue.

The issue seems related to using BoringSSL and newly introduced Flipper using openSSL

Please note it works OK on simulator

My error is :

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

From package.json

    "@react-native-firebase/app": "^6.3.4",
    "@react-native-firebase/auth": "^6.3.4",
    "@react-native-firebase/firestore": "^6.3.4",
    "@react-native-firebase/functions": "^6.3.4",

Podfile:

  version = '~> 0.33.1'
  pod 'FlipperKit', version, :configuration => 'Debug'

PS: I also tried with FlipperKit version 0.35 with same issue.

Happy to provide more context if needed.

Thanks

Build Error Crash iOS Solution Provided React Native

Most helpful comment

Sadly confirmed. Out of the box react-native-firebase is does not work on real iOS devices with react-native 0.62.

Original report was RNFBv6, I'm on RNFBv5.6.0 so it's a pretty general incompatibility. I think it might be a general problem with react-native 0.62 actually, and react-native-firebase is just collateral damage

Workarounds:

  1. Disable bitcode like the message says (app build settings 'enable bitcode' to 'no', confirmed works, but this solution isn't great)
  2. Use a version of the OpenSSL-Universal pod with bitcode (it was just changed: https://github.com/krzyzanowskim/OpenSSL/pull/74) - that's version 1.2.0.18 - I do not know Podfiles well enough to programmatically alter the version number from 1.2.0.18, is it possible?
  3. I'm testing right now if only disabling bitcode in development is sufficient. Flipper is not supposed to be enabled in release, so perhaps it will work? I'm testing that now

All 34 comments

Interesting, I'm upgrading to 0.62 right now and haven't gotten this far

My only quibble is that the thing you link is not an issue, it is a StackOverflow post. I love StackOverflow, but an issue in this context would be something in either the react-native or flipper github repos

Can you search through there (creating an issue if need be) and cross-link it in to here? That would allow us to track any upstream activity

Any help here would be appreciated. We've not had chance yet to test on RN .62.

Yeah - I'm in the middle of it (and in the middle of home-schooling, so it's slow) but almost done with my move to 0.62. I'll certainly post success or failure. Hopefully success!

Sadly confirmed. Out of the box react-native-firebase is does not work on real iOS devices with react-native 0.62.

Original report was RNFBv6, I'm on RNFBv5.6.0 so it's a pretty general incompatibility. I think it might be a general problem with react-native 0.62 actually, and react-native-firebase is just collateral damage

Workarounds:

  1. Disable bitcode like the message says (app build settings 'enable bitcode' to 'no', confirmed works, but this solution isn't great)
  2. Use a version of the OpenSSL-Universal pod with bitcode (it was just changed: https://github.com/krzyzanowskim/OpenSSL/pull/74) - that's version 1.2.0.18 - I do not know Podfiles well enough to programmatically alter the version number from 1.2.0.18, is it possible?
  3. I'm testing right now if only disabling bitcode in development is sufficient. Flipper is not supposed to be enabled in release, so perhaps it will work? I'm testing that now

I had success with item 3 from above list - I had bitcode off for development and on for release, and a release mode TestFlight build was fine, so we have a workable setup for now at least.

I'm going to close this as it's upstream and has a workaround, but the heads up was useful and others should be able to find it here now for help (or we can point the way) thanks @jbtheard

When I put disable bitcode in Debug mode, I get all kinds of Swift error that I've never had.
Screen Shot 2020-05-09 at 1 02 35 PM

This work around did def not work for me. Tried physical device and emulator. Both don't work.

@Benzer1406 no one else has complained yet so this is surprising. Did you npx react-native-clean-project and blow out everything to make sure there was no stale state?

@mikehardy Yes, I did clean the project, deleted the caches and so on without success. Not working on iOS.
Are there plans to include bitcode in the OpenSSL-Universal library given that deactivating bitcode in debug mode is just a workaround?

@Benzer1406 no idea, I see you commented on the upstream issues, that's where to chase it, I'm just a user of the upstream stuff though I help maintain here so I've got no inside track with regard to status.

I still don't reproduce your current issue though - important to mention that I have no issues currently while using the workaround (I mention that not because it's immediately useful, but if I were you it might prompt me to dig through my project settings again, it seems like it should work)

Oh, another option is to just kill flipper. It's integrated by default now but you can de-integrate it.

@mikehardy Thanks, yeah, I’ll probably dig through the build settings again. But how can I disable Flipper without undoing all the code changes I had to do to upgrade to RN 0.62.2?

By carefully teasing out the flipper integration? I've never tried it but upgrade-helper https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.62.2 tells me it's probably just Podfile and AppDelegate. Like I said, I can't reproduce so I have no actual idea. It works for me.

@mikehardy I could fix it. It probably had nothing to do with Flipper.

I found the solution here: https://github.com/mxcl/PromiseKit/issues/1059#issuecomment-493925940

  1. Open ios/YourAppName.xcodeproj in Xcode
  2. Right-click on Your App Name in the Project Navigator on the left, and click New File…
  3. Create a single empty Swift file to the project (make sure that Your App Name target is selected when adding)
  4. When Xcode asks, press Create Bridging Header and do not remove Swift file then. re-run your build.
    This should fix the problem

Was probably a missing Swift bridge, given that I didn't have any Swift files. Thanks for the help though!

I still have that dummy swift bridging header but was told by one of the upstream devs that this would remove the need for it if I followed it - haven't tried it myself https://fbflipper.com/docs/troubleshooting#build-errors-in-react-native

By carefully teasing out the flipper integration? I've never tried it but upgrade-helper https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.62.2 tells me it's probably just Podfile and AppDelegate. Like I said, I can't reproduce so I have no actual idea. It works for me.

For anyone else experiencing this issue, this approach worked for me. Comment out any flipper relevant code in Podfile & AppDelegate and you should be good. (Except there's obviously no flipper support).

Also, you may want to check this if you're getting weird swift errors.

Just keeping anyone tracking this up-to-date. This was just merged krzyzanowskim/OpenSSL#83 but the pod can't be updated to 1.0.2.20 due to Folly's podspec

FlipperKit/FBCxxFollyDynamicConvert (~> 0.33.1) was resolved to 0.33.1, which depends on
      Flipper-Folly (~> 2.1) was resolved to 2.2.0, which depends on
        OpenSSL-Universal (= 1.0.2.19)

Sorry I think I posted this in the wrong place 3x before I found the repo where it belongs, but also updated here which @mikehardy and @Benzer1406 looks like you're tracking as well

No problem! If anyone wants to update their pod to test that would be great - I speculatively submitted this to do so officially but confirmation will help it https://github.com/facebook/flipper/pull/1171

By carefully teasing out the flipper integration? I've never tried it but upgrade-helper https://react-native-community.github.io/upgrade-helper/?from=0.61.5&to=0.62.2 tells me it's probably just Podfile and AppDelegate. Like I said, I can't reproduce so I have no actual idea. It works for me.

For anyone else experiencing this issue, this approach worked for me. Comment out any flipper relevant code in Podfile & AppDelegate and you should be good. (Except there's obviously no flipper support).

Also, you may want to check this if you're getting weird swift errors.

Thank you! Worked for me just removing the code from AppDelegate.

@nilde Could you please highlight the code sections you took out?
Thanks.

Or anyone else ?

@danielolamide

these lines, and the 3 that include InitializeFlipper just below as well

https://github.com/facebook/react-native/blob/b9944e54ae35c2beed0e78ea454d871e0fe92ec6/template/ios/HelloWorld/AppDelegate.m#L7-L24

Found a solution to the upgrade issue to RN 0.63.2 mainly from the @chesterCharles solution here:
https://github.com/react-native-community/upgrade-support/issues/25
So in summary, my complete upgrade steps were

Follow the 0.63.2 RN upgrade
https://react-native-community.github.io/upgrade

1) For the project.pbxproj changes, follow all four steps in the React Native 0.62 upgrade explanation in this repo:
https://github.com/react-native-community/upgrade-support/issues/13

2) Enable Dead Code Stripping in Build Settings for both debug and release in each project target

3) Set Always Embed Swift Standard Libraries to YES in the build settings for my project and all my targets.

4) Either add a Dummy.swift file to the project, or don't delete the dummy swift file that you created in step 2 (the issue #13 in this repo).

I had success with item 3 from above list - I had bitcode off for development and on for release, and a release mode TestFlight build was fine, so we have a workable setup for now at least.

Im facing the same issue and when i checked that it is already in * bitcode off for development and on for release" but still face same issue.

How to update OpenSsl-universal?

Thanks

@Osamasomy

Im facing the same issue and when i checked that it is already in * bitcode off for development and on for release" but still face same issue.

Unfortunately no one ever faces the same issue, and this is from April 1st, so I doubt you have any of the same versions (you shouldn't, you should have updated as new stable versions were released)

You should make sure you have run npx react-native-clean-project and re-installed pods etc to get a clean build, as the solution proposed works with success confirmation from multiple and no further complaints

How to update OpenSsl-universal?

You get this PR merged: https://github.com/facebook/flipper/pull/1171

I tried, I will be very excited if you can get it done!

Disabling bitcode, running npx react-native-clean-project & then building again does not solve this issue.

@wouterds it is still working perfectly for me after all this time. I am literally building my app for release right now, after building it for debug this morning, no issues

And it keeps working if you run the following?

rm -rf ios rm -rf node_modules
pod repo update
git checkout ios
yarn
cd ios && pod install

I'm having this issue in a reasonable clean RN native project of a few days old.
Hasn't gone through any weird shit to make it work yet.

That's not even enough I think. I use npx react-native-clean-project to actually purge things.

My fastlane recipe calls in to deep-clean:

    "deep-clean": "./node_modules/.bin/react-native-clean-project --keep-node-modules --remove-iOS-build --keep-brew --keep-pods --remove-iOS-pods --clean-android-project --remove-android-build && yarn clean",
    "clean": "\\rm -fr ./node_modules dist/* ios/build ios/Pods ios/KScoreApp.xcarchive android/build android/app/build public/js public/assets && yarn",

I had the same issue for latest RN and firebase modules:

"@react-native-firebase/analytics": "^7.6.7",
"@react-native-firebase/app": "^8.4.5",
"@react-native-firebase/crashlytics": "^8.4.9",
"@react-native-firebase/database": "7.5.11",
"@react-native-firebase/messaging": "^7.9.0",
"@react-native-firebase/remote-config": "^9.0.10",
"react": "16.13.1",
"react-native": "0.63.3",

This PR https://github.com/facebook/flipper/pull/1171 is still not merged to master, and it seems that 1.0.2.19 version is used for OpenSSL. I cannot find where I need to change this version to 1.0.2.20.

So to run my 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.

@maxweb4u Thanks, just came across the exact same problem today.

I wasn't able to build my app for real device with libcrypto.a missing bitcode error.
Removing flipper reference from my PodFile and AppDelegate.m allowed me to build my app for real device as you advised.

There is finally some motion on my PR against Flipper to update OpenSSL so maybe this will be fixed once and for all! Yes!
Even if so it will be a while before the updated version of Flipper is then incorporated in react-native etc, but there's hope.

This was resolved upstream, delete Podfile.lock and re run pod install and it should be resolved for everyone

Was this page helpful?
0 / 5 - 0 ratings