Skip to content
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

🔥 library not found for -lRNFirebase #1978

Closed
6 of 34 tasks
dani-mp opened this issue Mar 15, 2019 · 26 comments
Closed
6 of 34 tasks

🔥 library not found for -lRNFirebase #1978

dani-mp opened this issue Mar 15, 2019 · 26 comments

Comments

@dani-mp
Copy link

dani-mp commented Mar 15, 2019

Issue

I can't get Firebase Analytics on iOS working because the project doesn't compile. I get this error: library not found for -lRNFirebase.

Some notes:

  • I have a background as an iOS developer, so I'm familiar with both Cocoapods and Xcode.
  • I've followed the installation guide for iOS step by step, I understand it and I don't see anything wrong there.
  • I've installed Firebase/Core via Cocoapods and before integrating react-native-firebase, the app was compiling and I could see my project in the Firebase dashboard.
  • I'm not using Cocoapods to integrate the react native library.
  • I've used react-native link react-native-firebase and the changes applied to my Xcode project makes sense, basically it has added both RNFirebase.xcodeproj and libRNFirebase.a to my project.
  • I get the same error both compiling using Xcode and vía react-native run-ios.
  • Unrelated, but I got it working on Android without any problem.

It seems libRNFirebase.a can't be built because it doesn't detect the libraries installed via Cocoapods.


Project Files

iOS

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:

I'm using Cocoapods only for Firebase/Core and this is properly working. The compilation problem appears when I link the React Native library via react-native link.

AppDelegate.m:

// N/A

Android

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • If known, the version of the platform are you experiencing the issue on:
    • iOS 12
  • Operating System:
    • MacOS, version: Mojave
    • Windows, version: N/A
    • Other, please specify: N/A
  • Build Tools:
    • Xcode 10
  • React Native version:
    • 58
  • React Native Firebase library version:
    • 5.2.3
  • Firebase module(s) you're using that has the issue:
    • N/A
    • Authentication
    • Analytics
    • Cloud Firestore
    • Cloud Messaging (FCM)
    • Crashlytics
    • Dynamic Links
    • Functions Callable
    • In App Messaging
    • Indexing
    • Invites
    • Instance ID
    • ML Kit
    • Notifications
    • Performance Monitoring
    • Realtime Database
    • Remote Config
    • Storage
  • Are you using TypeScript?
    • No
    • Yes, version: N/A
  • Are you using Expo, e.g. ExpoKit?
    • No
    • Yes, I've not ejected
    • Yes, but I have ejected to ExpoKit
    • Yes, but I have ejected to vanilla React Native
    • Expo version: N/A

Think react-native-firebase is great? Please consider supporting the project with any of the below:

@dani-mp dani-mp changed the title 🔥 library not found for -lRNFirebase 🔥library not found for -lRNFirebase Mar 15, 2019
@dani-mp dani-mp changed the title 🔥library not found for -lRNFirebase 🔥 library not found for -lRNFirebase Mar 15, 2019
@aryalprakash
Copy link

@danielmartinprieto I'm also getting this error. Did you find any solution?

@dani-mp
Copy link
Author

dani-mp commented Mar 24, 2019

No, sorry, @aryalprakash. I’m waiting for the maintainers to give some clues, maybe they know what’s going on here.

@aryalprakash
Copy link

@danielmartinprieto I removed react-native-firebse from node_modules and reinstalled package. Then the error is gone. I don't know why though.

@dani-mp
Copy link
Author

dani-mp commented Mar 25, 2019

Just removing react-native-firebase from node_modules and run npm install again doesn't work for me.

@aryalprakash apart from removing the library from node_modules, have you unlinked it as well?

@dentemm
Copy link

dentemm commented Mar 25, 2019

I am having the same problem, nothing I have tried so far works

@dani-mp
Copy link
Author

dani-mp commented Mar 25, 2019

It seems there are more people with the same problem: https://stackoverflow.com/questions/53617257/library-not-found-for-lrnfirebase-react-native

@lunatolun
Copy link

I had the exact same error and I noticed something. in xCode, under Pods > Pods, the libraries were invisible. I went and checked if they were actually there, and yes, they were. I restarted XCode and the folders were there this time, and stopped giving the error. Weird...

@famu1hundred
Copy link

I was able to resolve this by restarting XCode, deleting my node_modules folder and running yarn (or npm install). Clean and Build...error gone

@dani-mp
Copy link
Author

dani-mp commented Apr 1, 2019

I think these two last comment weren't the same problem, as I'm not even using Xcode to compile the project, but react-native cli. Also, I can reproduce it in my CI setup, where things are not cached.

@stale
Copy link

stale bot commented Apr 29, 2019

Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Type: Stale Issue has become stale - automatically added by Stale bot label Apr 29, 2019
@dani-mp
Copy link
Author

dani-mp commented Apr 29, 2019

Oh 😢

@stale stale bot removed the Type: Stale Issue has become stale - automatically added by Stale bot label Apr 29, 2019
@mikehardy
Copy link
Collaborator

FWIW I have this working well in Android and iOS, so know that it is possible. Also worth mentioning that I had to do a search through my linking search paths and make sure they were correct, during install. There were some entries duplicated, recursion where it shouldn't be etc. You mention you are experienced with pods + xcode, so if you hunt down your linker paths and make sure they are perfect this should work. You may also look at the react-native-firebase starter project and see how it works, as it will work out of the box

@dani-mp
Copy link
Author

dani-mp commented Apr 29, 2019

Thanks, @mikehardy.

Could you please share your search paths configuration to see if we're doing something wrong? We have integrated some other native libraries like this and they all work, so I'm wondering if there is something in particular I should pay attention to integrating this library's bridge in an iOS app.

I will also take a look at the Xcode's config of the react-native-firebase starter project to see if I can find something.

@mikehardy
Copy link
Collaborator

bulid settings -> other linker flags -> 2 entries, $(inherited) and -lc++

I don't think there is anything else going on for my project, but I recall that it was a mess before I stripped it down to that and put the inherited in there. I am actually pretty novice at XCode/iOS so if there is a better way to get that info I won't know. Perhaps there is a chunk of raw plist or project file that is good

@dani-mp
Copy link
Author

dani-mp commented Apr 29, 2019

I've confirmed I have those as well. There must be something else (or something missing) in my project and I get that error.

@emkou
Copy link

emkou commented May 8, 2019

Do you have any other build configurations apart from Develop and Release ?

@brianinator
Copy link

I'm able to reproduce on App Center CI but not on development machine. I am a bit perplexed.

@mikehardy
Copy link
Collaborator

Creation of functioning (archivable) react-native-firebase app, from init to running: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

@mikehardy
Copy link
Collaborator

As I was scanning through this might be the best place to focus for that #1667 @testshallpasswork

@vixchauhan
Copy link

in my case when i try to build in xcode it's giving me above error
i have fixed this issue by doing following steps

  1. npm install
  2. go to ios dir
  3. pod install
  4. go back to project root dir and run react-native link

@2n2n
Copy link

2n2n commented Jul 27, 2019

Oh boy, I fixed this because I selected the wrong file to open.

  1. close xcode
  2. open another project..
  3. select ios/myproject.xcworkspace not myproject.xcodeproj
  4. open terminal targeting to the root of your project folder and run rm -rf ./node_module && npm install (you can also use yarn by replacing npm install.)
  5. react-native link
  6. build and run

@mohshbool
Copy link

mohshbool commented Aug 2, 2019

Oh boy, I fixed this because I selected the wrong file to open.

  1. close xcode
  2. open another project..
  3. select ios/myproject.xcworkspace not myproject.xcodeproj
  4. open terminal targeting to the root of your project folder and run rm -rf ./node_module && npm install (you can also use yarn by replacing npm install.)
  5. react-native link
  6. build and run

that didn't solve my problem. using react-native: 0.59.9 and react-native-firebase: 5.5.3 with pod 'Firebase/Core', '~> 6.3.0'

EDIT: I added libRNFirebase.a to link with binary libraries, now i'm getting this error library not found for -lFirebaseAuth

@mikehardy
Copy link
Collaborator

Check mikehardy/rnfbdemo repo on github. Make-demo-rrn59.sh script shows how to make it work

@moahammadalt

This comment has been minimized.

@mikehardy

This comment has been minimized.

@mikehardy
Copy link
Collaborator

This is clearly attracting low-quality comments. My comment above for RN59 contains the canonical example of how to integrate react-native-firebase with a react-native 0.59 project, which was the original bug. Should you need to, there's a script in that repo that does the same for RN60. Follow those steps exactly and it works.

@invertase invertase locked as resolved and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests