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

[🐛] 'FirebaseCoreExtension/FIRLibrary.h' file not found #6322

Closed
FelipeLimaDeSouza opened this issue Jun 20, 2022 · 39 comments
Closed

[🐛] 'FirebaseCoreExtension/FIRLibrary.h' file not found #6322

FelipeLimaDeSouza opened this issue Jun 20, 2022 · 39 comments
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report

Comments

@FelipeLimaDeSouza
Copy link

FelipeLimaDeSouza commented Jun 20, 2022

I updated my reac-native-firebase version to 15.0.0
Later I didn't start my project.

Error on: RNFBCrashlyticsInitProvider: 'FirebaseCoreExtension/FIRLibrary.h' file not found

My Podfile

$RNFirebaseAnalyticsWithoutAdIdSupport=true
$RNFirebaseAsStaticFramework=true

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
use_frameworks!

permissions_path = '../node_modules/react-native-permissions/ios'

target 'App' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  pod 'CryptoSwift', '1.4.0'
  pod 'SharkORM', '2.3.62'
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  # use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"

  pod 'react-native-date-picker', :path => '../node_modules/react-native-date-picker'

  pod 'react-native-sensitive-info', :path => '../node_modules/react-native-sensitive-info'


  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # flipper_post_install(installer)
    
  end

  $static_framework = [
    'CocoaAsyncSocket', 'ComponentKit',
    'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native',
    'RNFBApp', 'RNFBAuth', 'RNFBFirestore', 'RNFBStorage', 'RNFBDatabase',
    'RNFBDynamicLinks', 'RNFBPerf', 'RNFBAnalytics', 'RNFBCrashlytics',
    'Permission-Camera', 'Permission-PhotoLibrary', 'Permission-PhotoLibraryAddOnly',
    'Permission-LocationAlways',
    'RNPermissions']

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

    installer.pod_targets.each do |pod|
        if $static_framework.include?(pod.name)
          def pod.build_type;
            Pod::BuildType.static_library
          end
        end
    end
  end

end

My package.json (react and react native version)

"react": "^17.0.2",
"react-native": "^0.67.4",

My package.json (firebase version)

"@react-native-firebase/analytics": "^15.0.0",
"@react-native-firebase/app": "^15.0.0",
"@react-native-firebase/crashlytics": "^15.0.0",
"@react-native-firebase/database": "^15.0.0",

OS Version

macOs Monterrey 12.4
Xcode 13.4.1

@FelipeLimaDeSouza FelipeLimaDeSouza added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels Jun 20, 2022
@mikehardy
Copy link
Collaborator

Hmm, something's not right.

I don't know about this bit:


  $static_framework = [
    'CocoaAsyncSocket', 'ComponentKit',
    'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native',
    'RNFBApp', 'RNFBAuth', 'RNFBFirestore', 'RNFBStorage', 'RNFBDatabase',
    'RNFBDynamicLinks', 'RNFBPerf', 'RNFBAnalytics', 'RNFBCrashlytics',
    'Permission-Camera', 'Permission-PhotoLibrary', 'Permission-PhotoLibraryAddOnly',
    'Permission-LocationAlways',
    'RNPermissions']

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

Looks like a workaround we haven't verified. That's not how I developed the new version.

Rip all that out, just do use_frameworks!, see how it goes ?

Make sure this is there? https://rnfirebase.io/#allow-ios-static-frameworks ($RNFirebaseAsStaticFramework = true in your Podfile, then reinstall pods)

Additionally, you've purged out all sorts of other useful info like, for instance, what version of react-native are you on? What version of macOS / Xcode?

I just updated my demo script to verify this all can work and it works for me with the appropriate static frameworks updates: https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

@FelipeLimaDeSouza
Copy link
Author

FelipeLimaDeSouza commented Jun 20, 2022

Hmm, something's not right.

I don't know about this bit:


  $static_framework = [
    'CocoaAsyncSocket', 'ComponentKit',
    'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native',
    'RNFBApp', 'RNFBAuth', 'RNFBFirestore', 'RNFBStorage', 'RNFBDatabase',
    'RNFBDynamicLinks', 'RNFBPerf', 'RNFBAnalytics', 'RNFBCrashlytics',
    'Permission-Camera', 'Permission-PhotoLibrary', 'Permission-PhotoLibraryAddOnly',
    'Permission-LocationAlways',
    'RNPermissions']

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

Looks like a workaround we haven't verified. That's not how I developed the new version.

Rip all that out, just do use_frameworks!, see how it goes ?

Make sure this is there? https://rnfirebase.io/#allow-ios-static-frameworks ($RNFirebaseAsStaticFramework = true in your Podfile, then reinstall pods)

Additionally, you've purged out all sorts of other useful info like, for instance, what version of react-native are you on? What version of macOS / Xcode?

I just updated my demo script to verify this all can work and it works for me with the appropriate static frameworks updates: https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

I updated my issue with O.S and RN version
I removed the static_framework but not working
Now my file is like:

$RNFirebaseAnalyticsWithoutAdIdSupport=true
$RNFirebaseAsStaticFramework=true

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
use_frameworks!

permissions_path = '../node_modules/react-native-permissions/ios'

target 'App' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  pod 'CryptoSwift', '1.4.0'
  pod 'SharkORM', '2.3.62'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"

  pod 'react-native-date-picker', :path => '../node_modules/react-native-date-picker'

  pod 'react-native-sensitive-info', :path => '../node_modules/react-native-sensitive-info'


  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end

end

@mikehardy
Copy link
Collaborator

All I can say is I have a fully scripted demo with comments on what each step is doing, and you can run it and it works - the make-demo.sh script

Please try it to make sure it works - somewhere in the difference between what it does and your project is the difference, but I'd like to see if the demo works in your environment, then you can start looking for differences? There must be something different in the Podfile from the demo and your project. Versions seem okay, I don't think react-native 0.67 vs 0.68 will matter though that is a difference

@enchorb
Copy link

enchorb commented Jun 20, 2022

Also had this issue and had to downgrade back to 14.11.0 got it after attempting the workarounds in facebook/react-native#32451

@mikehardy
Copy link
Collaborator

Does https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh work for you in your environment @enchorb ?

@mikehardy
Copy link
Collaborator

mikehardy commented Jun 21, 2022

Incidentally - @enchorb hermes will not work until this is released: facebook/react-native#34030 (comment) - which will likely be react-native 0.69.1 (note: 0.69.0 is not out yet but it's closed for pick requests now and this hermes fix literally just merged a few minutes ago)

Right now for react-native-firebase v15 you need react-native 0.68.2 or lower, hermes off, flipper off, and not the react native new architecture. The changelog mentions the same along with some links for more details on progress removing those restrictions.

[update - I've got a patch for react-native 0.69.0 that lets it work, with hermes even, just no flipper or new architecture: https://github.com/mikehardy/rnfbdemo/blob/main/patches/react-native%2B0.69.0.patch ]

@Fawxy

This comment was marked as resolved.

@mikehardy
Copy link
Collaborator

@Fawxy - can you specify anything more about your environment than

I'm using Xcode 13.4.1 (13F100)

?

In my "seems to work fine" environment(s) I have this for instance:

$ /Users/mike/work/Invertase/rnfbdemo/rnfbdemo/node_modules/.bin/react-native info
info Fetching system and libraries information...
System:
    OS: macOS 12.4
    CPU: (12) x64 Intel Core Processor (Skylake)
    Memory: 268.38 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.15.1 - /var/folders/8q/bdwkf_zx2hl8_5k2920t28m40000gn/T/yarn--1655780212104-0.5449825354184776/node
    Yarn: 1.22.19 - /var/folders/8q/bdwkf_zx2hl8_5k2920t28m40000gn/T/yarn--1655780212104-0.5449825354184776/yarn
    npm: 8.12.1 - ~/.nvm/versions/node/v16.15.1/bin/npm
    Watchman: 2022.06.13.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/mike/.rvm/gems/ruby-3.1.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 28, 30, 31, 32
      Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0
      System Images: android-31 | Google APIs Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.2 => 0.68.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
✨  Done in 3.67s.

@KubilayKerim

This comment was marked as resolved.

@mikehardy
Copy link
Collaborator

Here's what make-demo results in, compare and constrast, perhaps modify your Podfile to look like it?

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'rnfbdemo' do
  config = use_native_modules!
  config = use_frameworks!
  $RNFirebaseAsStaticFramework = true

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  $FirebaseSDKVersion = '9.1.0'
  target 'rnfbdemoTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  #use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    
    installer.aggregate_targets.each do |aggregate_target|
      aggregate_target.user_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(SDKROOT)/System/iOSSupport/usr/lib/swift', '$(inherited)']
        end
      end
      aggregate_target.user_project.save
    end
    
    installer.pods_project.targets.each do |target|
      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
          config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"] = "-"
        end
      end
    end
    installer.pods_project.targets.each do |target|
      if (target.name.eql?('FBReactNativeSpec'))
        target.build_phases.each do |build_phase|
          if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
            target.build_phases.move(build_phase, 0)
          end
        end
      end
    end
    
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["GCC_WARN_INHIBIT_ALL_WARNINGS"] = "YES"
      end
    end
    
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["CC"] = "clang"
        config.build_settings["LD"] = "clang"
        config.build_settings["CXX"] = "clang++"
        config.build_settings["LDPLUSPLUS"] = "clang++"
      end
    end
    
    installer.aggregate_targets.each do |aggregate_target|
      aggregate_target.user_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
          config.build_settings['EXCLUDED_ARCHS'] = 'i386'
        end
      end
      aggregate_target.user_project.save
    end
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

Screenshot from 2022-06-21 07-38-45

@KubilayKerim

This comment was marked as outdated.

@mikehardy
Copy link
Collaborator

@KubilayKerim how did it go when you actually ran https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh in your environment ? I cannot troubleshoot specific projects as there are an infinite variety of ways people can do things that fail. So I offer that script which builds things from scratch and allows us to make solid assumptions about what is actually in the project (since it's constructed in a fully automated way)

@FelipeLimaDeSouza
Copy link
Author

Also had this issue and had to downgrade back to 14.11.0 got it after attempting the workarounds in facebook/react-native#32451

It's working for me. Tks

@mikehardy rollback version to 14.11.0 is working for me

@mikehardy
Copy link
Collaborator

@mikehardy rollback version to 14.11.0 is working for me

Which unfortunately leaves you with no future as you can't stay there forever.

Does https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh work for you in your environment ?

@FelipeLimaDeSouza

This comment was marked as resolved.

@mikehardy

This comment was marked as resolved.

@KubilayKerim

This comment was marked as off-topic.

@Fawxy
Copy link

Fawxy commented Jun 22, 2022

I've rerun the build script from scratch and it seems to be working as expected. Here is my react-native info of the project that does not work with v15

System:
    OS: macOS 12.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 29.50 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2022.05.30.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /Users/chrisbyatt/.jenv/shims/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.2 => 0.68.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

@baselshlewett

This comment was marked as off-topic.

@mikehardy

This comment was marked as resolved.

@baselshlewett

This comment was marked as outdated.

@KubilayKerim

This comment was marked as off-topic.

@mikehardy

This comment was marked as off-topic.

@mikehardy
Copy link
Collaborator

Current status here for me is that this is still not reproducible. I continue working on making the experience better though and current state is that with this patch (which is what will be released in react-native 0.69.1) I even have this working:

  • react-native-firebase v15+
  • react-native-google-mobile-ads v7+
  • react-native 0.69.0 + hermes

I qualify this stuff and prove to myself that it's working literally multiple times a day, from scratch using this script https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

Any note about build failures should be similarly reproducible so if there is a problem we may conclusively identify + fix it

@igorcesarcode

This comment was marked as duplicate.

@mikehardy
Copy link
Collaborator

mikehardy commented Jun 27, 2022

@igorcesarcode you are using use_frameworks! but not $RNFirebaseAsStaticFramework=true in your Podfile, that's my guess --> https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

@KubilayKerim

This comment was marked as off-topic.

@mikehardy

This comment was marked as off-topic.

@brascene
Copy link

brascene commented Jun 28, 2022

I'm also facing the same issue.. fresh app and everything, core Firebase module was installed successfully but when I added Crashlythics package it failed with the same error 'FirebaseCoreExtension/FIRLibrary.h' file not found .

My Podfile is same like you've described here, except that part for post_install.

Update: After reading this, I've added Storage just to check if it'll work, and it does now. So previously, FirebaseCoreExtension wasn't installed in Pods, and now it is.

@mikehardy

This comment was marked as resolved.

mikehardy added a commit that referenced this issue Jun 28, 2022
Crashlytics uses headers from this extension cocoapod, but it is only brought-in
automatically by Storage and Functions currently. Depend on it directly

#6322 (comment)
@mikehardy

This comment was marked as resolved.

@brascene

This comment was marked as resolved.

@mikehardy
Copy link
Collaborator

mikehardy commented Jun 28, 2022

Boom! react-native-firebase v15.1.1 coming up with the fix. Thanks a bunch for confirming 🙇

I'll collapse the other comments since the thread is getting big and we may discover other things, so current state is:

For react-native-firebase v15 to work for people:

  • you must use use_frameworks! in podfile (which implies: flipper and hermes and new architecture must be disabled)
  • you must set $RNFirebaseAsStaticFramework=true in podfile
  • you must use v15.1.1+ (releasing this moment) if you use crashlytics without storage or functions

There are no other currently known failure modes, but each of this could get you iOS build failure with this message.

mikehardy added a commit that referenced this issue Jun 28, 2022
Crashlytics uses headers from this extension cocoapod, but it is only brought-in
automatically by Storage and Functions currently. Depend on it directly

#6322 (comment)
@vargajacint

This comment was marked as off-topic.

@mikehardy
Copy link
Collaborator

Indeed, 0.69.x is still not ready unfortunately - and no build will be ready with hermes yet. I was under the impression that 0.68.x would work but perhaps reanimated cannot? You should post that in their repo if so, with a reproduction if possible, or if it is just because hermes does not work then track this:

reactwg/react-native-releases#24 (comment)

I understand this can be frustrating, apologies. There is no reason I know of that using react-native-firebase 14.11.1 will result in serious issues at the moment. It won't receive updates of course but it is not a terrible choice, it was current quite recently after all

@marf

This comment was marked as off-topic.

@michaelbayday
Copy link

FYI, we also ran into this issue with 15.1.1 when using a older version of Firebase iOS SDK. We resolved it by updating to SDK 9.2.0

@mikehardy
Copy link
Collaborator

This issue should be restricted to discussing build errors that fail with this error and this error only please:

'FirebaseCoreExtension/FIRLibrary.h' file not found

Other problems are being tracked elsewhere, but this is still a live topic for this error and I would like to keep it focused. Thank you!

There is apparently a need for @react-native-firebase/messaging to bring in the firebase extension pod, the same as crashlytics needed in #6352 - I have made a new PR #6405 to hopefully fix it. I am waiting on a test result for that from the affected user.

If anyone else notices a module that is normally used in combination with other modules (which hides this error!) but fails with this error message by itself, please let me know (and/or post a PR like #6405 and #6352)

Thanks!

@mikehardy
Copy link
Collaborator

I believe this issue is resolved, since there has been no traffic for a month and we did successfully reproduce a couple build errors and release fixes for them.

Of note is that with react-native 0.70.0 we will be able to use use_frameworks with hermes enabled on iOS again. Still working on Flipper, still working on react-native new architecture, but we'll get there.

Thanks everyone for the collaboration here and your patience as we transition to use_frameworks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report
Projects
None yet
Development

No branches or pull requests