react-native: React-bridging wrong paths?

Description

CleanShot 2022-06-29 at 18 44 51 Wrong React-bridging directories structure: xxx/ios/Pods/Headers/Public/React-bridging/react/bridging/react/bridging/LongLivedObject.h should be: xxx/ios/Pods/Headers/Public/React-bridging/react/bridging/LongLivedObject.h

So xxx/node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h has wrong imports like

#include <react/bridging/CallbackWrapper.h>
#include <react/bridging/LongLivedObject.h>

Version

0.69.1

Output of npx react-native info

warn Package react-native-appsflyer has been ignored because it contains invalid configuration. Reason: “dependency.platforms.ios.podspecPath” is not allowed warn Package @svgr/webpack has been ignored because it contains invalid configuration. Reason: Package subpath ‘./package.json’ is not defined by “exports” in /Users/webx/_WEBX/gigaverse-mobile/node_modules/@svgr/webpack/package.json info Fetching system and libraries information… System: OS: macOS 12.4 CPU: (8) arm64 Apple M1 Memory: 102.55 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node Yarn: 1.22.19 - ~/.yarn/bin/yarn npm: 8.5.5 - ~/.nvm/versions/node/v16.13.1/bin/npm Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Android NDK: 22.1.7171670 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /opt/homebrew/opt/openjdk@11/bin/javac npmPackages: @react-native-community/cli: Not Found react: ^18.2.0 => 18.2.0 react-native: ^0.69.1 => 0.69.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

0.69.1 react native and for example install react-native-vision-camera

Snack, code example, screenshot, or link to a repository

CleanShot 2022-06-29 at 18 51 42 CleanShot 2022-06-29 at 18 52 03 CleanShot 2022-06-29 at 18 52 13

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 12
  • Comments: 59 (6 by maintainers)

Commits related to this issue

Most upvoted comments

this may fix the header not found error:

--- a/ios/Podfile
+++ b/ios/Podfile
@@ -33,5 +33,14 @@ target 'RN069' do
   post_install do |installer|
     react_native_post_install(installer)
     __apply_Xcode_12_5_M1_post_install_workaround(installer)
+
+   installer.pods_project.targets.each do |target|
+     target.build_configurations.each do |config|
+       config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited) '
+       config.build_settings['HEADER_SEARCH_PATHS'] << '"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" '
+       config.build_settings['HEADER_SEARCH_PATHS'] << '"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers" '
+     end
+   end
+
   end
 end

if that works fine, maybe we could propose the fix to the react_native_post_install helper.

for jsi:: -> facebook::jsi:: namespace change, it is from 009d80bf5a55dd74be448960b1344ac7599c6bae and it’s a better practice IMO even though that requires third party modules to fix the breaking code.

It seems React Native 0.72.0 brought back this issue. I’m getting 'react/bridging/CallbackWrapper.h' file not found on 0.72.0. Build succeeds on 0.71.11. I tried a few of the workarounds here and in 1121, but no luck so far. I’ll keep trying different approaches and hold the upgrade for now.

Changing header_dir to dot helps:

diff --git a/node_modules/react-native/ReactCommon/React-bridging.podspec b/node_modules/react-native/ReactCommon/React-bridging.podspec
index 5255c13..52a8eb0 100644
--- a/node_modules/react-native/ReactCommon/React-bridging.podspec
+++ b/node_modules/react-native/ReactCommon/React-bridging.podspec
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
   s.source                 = source
   s.source_files           = "react/bridging/**/*.{cpp,h}"
   s.exclude_files          = "react/bridging/tests"
-  s.header_dir             = "react/bridging"
+  s.header_dir             = "."
   s.header_mappings_dir    = "."
   s.compiler_flags         = folly_compiler_flags
   s.pod_target_xcconfig    = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"",

Hi all, I’m a bit late to the party here and can’t remember all my steps, but I was running into this using React Native firebase with use_frameworks! :linkage => :static and an Nx monorepo, I think it may be a combo of those two things that caused my issues. I’m using “react-native”: “0.70.1” which seems to have @Kudo’s patch already in it to update the Header paths. After digging around on where the headers ended up I emulated what he had done in my Pod file and added the PODS_TARGET_SRCROOT to it and my app was able to build properly. YMMV.

(Note I’m a Typescipt/JS guy not an iOS developer so I’m just slightly informed on what I’m actually doing here)

   __apply_Xcode_12_5_M1_post_install_workaround(installer) // after this
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
        config.build_settings["HEADER_SEARCH_PATHS"] << '"$(PODS_TARGET_SRCROOT)" '
      end
    end

Changing header_dir to dot helps:

diff --git a/node_modules/react-native/ReactCommon/React-bridging.podspec b/node_modules/react-native/ReactCommon/React-bridging.podspec
index 5255c13..52a8eb0 100644
--- a/node_modules/react-native/ReactCommon/React-bridging.podspec
+++ b/node_modules/react-native/ReactCommon/React-bridging.podspec
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
   s.source                 = source
   s.source_files           = "react/bridging/**/*.{cpp,h}"
   s.exclude_files          = "react/bridging/tests"
-  s.header_dir             = "react/bridging"
+  s.header_dir             = "."
   s.header_mappings_dir    = "."
   s.compiler_flags         = folly_compiler_flags
   s.pod_target_xcconfig    = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"",

After doing this I’ve not got a new error:

Use of undeclared identifier 'jsi'; did you mean 'facebook::jsi'?

Screenshot 2022-07-06 at 16 02 00

Checkout this pull: https://github.com/mrousavy/react-native-vision-camera/pull/1109. Need to wait new release of vision camera… or you can use patch (it also fix android build errors): react-native-vision-camera+2.13.5.patch.txt

I’m still having this issue on 0.72.3 while trying to use react-native-vision-camera 2.15.4. None of the patches mentioned have worked.

Screenshot 2022-12-02 at 17 14 53

"react-native": "0.71.0-rc.3" same issue

hey folks - RN 0.69.3 is out and contains the fix from @Kudo; let us know if this issue is fixed now for you!

So, honestly I didn’t find any explicit solutions proposed besides commits / patches that were already merged into the main branch and theoretically are already applied to the react-native version I’m using. I don’t really understand if the issue I’m facing is on the react-native-vision-camera lib code or if it’s a problem with react-native itself, but the issue persists to me 😞

@kelset i am thinking to propose the workaround to react_native_pods.rb. that will fix the build errors from some third party modules like vision-camera.

Facing the same issue after upgrading to 0.69.1 Screen Shot 2022-06-30 at 4 56 43 PM

same on "react-native": "^0.72.8" i have to use use_modular_headers! and use_frameworks!

Same issue here, using react-native@0.72.4, react-native-vision-camera@^2.15.6 and @react-native-firebase/app@^18.3.1. Have to use use_frameworks! :linkage => :static in my Podfile as the firebase instructions say, but then I get the 'react/bridging/CallbackWrapper.h' file not found error. Have tried pretty much all possible workarounds posted on many issues and the error persists. Downgrading the react-native version is not an option for us, neither do I think it’s a good a idea to downgrade the @react-native-firebase/app version so that use_frameworks is no longer required. Does anyone have any clue on this?

@shirakaba #34214 was targeting for third party modules but not the app target. for app targets, please add the React-bridging search path to the project.pbxproj

Same exact issue here

> 11 | #include <react/bridging/CallbackWrapper.h>
     |          ^ 'react/bridging/CallbackWrapper.h' file not found

Have to use these, in the app.json

[
        "expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "14.0",
            "useFrameworks": "static"
          },
          "android": {
            "compileSdkVersion": 34,
            "targetSdkVersion": 34,
          }
        }
      ],

started happening once switched to useFrameworks: static I need firebase module as well as react-native-vision-camera and react-native-quick-crypto Happening with “react-native”: “0.72.6”

Also experiencing the issue (using use_frameworks! :linkage => :static for firebase), with “react-native”: “0.72.7”, “react-native-vision-camera”: “^3.6.12”,

@fontesrp these I did not, didn’t come across this issue to be honest. Thanks for the suggestion, I’ll spend some time reading and trying the proposed solutions there. I’ll let you know how it goes 👍

Seems to be fixed in 0.71.0-rc.5, but unfortunately this version is still not supported by expo, so my problem remains https://github.com/invertase/react-native-firebase/issues/6800

Hmm I’m running into this one trying to transition to use_frameworks! for react-native-firebase v15+ support. In my case there seems to be an issue with paths when using pnpm that’s preventing the headers from getting copied into the ios/Pods/Headers/Private/React-bridging/react/bridging folder like they should. Instead they get copied to ios/build/Build/node_modules/.pnpm/react-native@0.69.5_unoo4p5zfjb5v6bnauqzc4ataq_lx6v52nf6lj3r6bs5j5fbvoknq/node_modules/react-native/ReactCommon/react/bridging which is clearly not the correct location. This is on 0.69.5 expo 46.0.10 with dev-client .

@Kudo any idea where/when the paths get calculated for the copy step for header files on iOS? I have little familiarity with cocoapods so I haven’t been able to find it.

@Kudo @kelset still an issue in a project based on 0.69.3, I’m afraid. Here’s an MWE. It’s just the 0.69.3 starter template, with the files JSIUtils.h and JSIUtils.mm (from react-native-vision-camera) added to the iOS build target.

https://github.com/shirakaba/repro-react-bridging-header-not-found

It fails upon trying to build the file JSIUtils.mm, due to its include of <ReactCommon/TurboModuleUtils.h>.

image

My environment:

$ npx react-native info
info Fetching system and libraries information...
System:
    OS: macOS 12.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 17.97 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.volta/tools/image/node/16.13.1/bin/node
    Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
    npm: 8.1.2 - ~/.volta/tools/image/node/16.13.1/bin/npm
    Watchman: 4.9.0 - /Users/jamie/.nix-profile/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/jamie/.local/share/gem/ruby/3.0.0/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: 32
      Build Tools: 32.1.0, 33.0.0
      System Images: android-32 | Google Play ARM 64 v8a
      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: 17.0.1 - /Users/jamie/.nix-profile/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: 0.69.3 => 0.69.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

since this is fixed in 0.69.1, does it mean we can close this off?

thanks for the awesome example repo @Polyrion. my fix is to address the use_frameworks error on 0.69.0 and landed on 0.69.1. it makes sense for 0.69.1 well work. please let me know if you still encounter other errors on 0.69.1.

@kierancrown 😕 still got the issue Capture d’écran 2022-07-15 à 16 25 35

there is my patch file that got applied successfully :

diff --git a/node_modules/react-native/ReactCommon/React-bridging.podspec b/node_modules/react-native/ReactCommon/React-bridging.podspec
index 5255c13..52a8eb0 100644
--- a/node_modules/react-native/ReactCommon/React-bridging.podspec
+++ b/node_modules/react-native/ReactCommon/React-bridging.podspec
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
   s.source                 = source
   s.source_files           = "react/bridging/**/*.{cpp,h}"
   s.exclude_files          = "react/bridging/tests"
-  s.header_dir             = "react/bridging"
+  s.header_dir             = "."
   s.header_mappings_dir    = "."
   s.compiler_flags         = folly_compiler_flags
   s.pod_target_xcconfig    = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"",

Podfile :

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

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

use_frameworks!
target 'mapnav' do
  config = use_native_modules!

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

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"

  # Pods for Mapbox navigation
  pod 'MapboxNavigation', '~> 2.6'

  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}/.."
  )

  target 'mapnavTests' 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 these next few lines.
  if !ENV['CI']
    # local configuration
    # use_flipper!()
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
        end
      end
      react_native_post_install(installer)
      __apply_Xcode_12_5_M1_post_install_workaround(installer) if defined?(__apply_Xcode_12_5_M1_post_install_workaround)
    end
  else
    # CI configuration
    post_install do |installer|
      react_native_post_install(installer)
      __apply_Xcode_12_5_M1_post_install_workaround(installer) if defined?(__apply_Xcode_12_5_M1_post_install_workaround)
    end
  end
end

Pod install was successful

Installing DoubleConversion (1.1.6)
Installing FBLazyVector (0.69.1)
Installing FBReactNativeSpec (0.69.1)
Installing MapboxCommon (22.0.0)
Installing MapboxCoreMaps (10.6.1)
Installing MapboxCoreNavigation (2.6.0)
Installing MapboxDirections (2.6.0)
Installing MapboxMaps (10.6.1)
Installing MapboxMobileEvents (1.0.8)
Installing MapboxNavigation (2.6.0)
Installing MapboxNavigationNative (106.0.0)
Installing MapboxSpeech (2.0.1)
Installing Permission-Camera (3.5.0)
Installing Permission-LocationAccuracy (3.5.0)
Installing Permission-LocationAlways (3.5.0)
Installing Permission-LocationWhenInUse (3.5.0)
Installing Polyline (5.0.2)
Installing RCT-Folly (2021.06.28.00-v2)
Installing RCTRequired (0.69.1)
Installing RCTTypeSafety (0.69.1)
Installing RNBootSplash (4.2.3)
Installing RNFastImage (8.5.11)
Installing RNGestureHandler (2.5.0)
Installing RNPermissions (3.5.0)
Installing RNReanimated (2.9.1)
Installing RNSVG (12.3.0)
Installing RNScreens (3.15.0)
Installing React (0.69.1)
Installing React-Codegen (0.69.1)
Installing React-Core (0.69.1)
Installing React-CoreModules (0.69.1)
Installing React-RCTActionSheet (0.69.1)
Installing React-RCTAnimation (0.69.1)
Installing React-RCTBlob (0.69.1)
Installing React-RCTImage (0.69.1)
Installing React-RCTLinking (0.69.1)
Installing React-RCTNetwork (0.69.1)
Installing React-RCTSettings (0.69.1)
Installing React-RCTText (0.69.1)
Installing React-RCTVibration (0.69.1)
Installing React-bridging (0.69.1)
Installing React-callinvoker (0.69.1)
Installing React-cxxreact (0.69.1)
Installing React-jsi (0.69.1)
Installing React-jsiexecutor (0.69.1)
Installing React-jsinspector (0.69.1)
Installing React-logger (0.69.1)
Installing React-perflogger (0.69.1)
Installing React-runtimeexecutor (0.69.1)
Installing ReactCommon (0.69.1)
Installing SDWebImage (5.11.1)
Installing SDWebImageWebPCoder (0.8.5)
Installing Solar-dev (3.0.1)
Installing Turf (2.4.0)
Installing Yoga (1.14.0)
Installing boost (1.76.0)
Installing fmt (6.2.1)
Installing glog (0.3.5)
Installing libwebp (1.2.1)
Installing react-native-geolocation (2.1.0)
Installing react-native-safe-area-context (4.3.1)
Installing react-native-spinkit (1.4.1)

but still can’t understand why I still got the issue am I missing something ?

Also don’t forget to do a pod install afterwards

@kierancrown you’re talking about Kudo proposition with Podfile ? cause I tried too and didn’t work or can you just tell me which one work for you.

Sure. Create a file in your root directory called patches/react-native+0.69.1.patch with contents

diff --git a/node_modules/react-native/ReactCommon/React-bridging.podspec b/node_modules/react-native/ReactCommon/React-bridging.podspec
index 5255c13..52a8eb0 100644
--- a/node_modules/react-native/ReactCommon/React-bridging.podspec
+++ b/node_modules/react-native/ReactCommon/React-bridging.podspec
@@ -30,7 +30,7 @@ Pod::Spec.new do |s|
   s.source                 = source
   s.source_files           = "react/bridging/**/*.{cpp,h}"
   s.exclude_files          = "react/bridging/tests"
-  s.header_dir             = "react/bridging"
+  s.header_dir             = "."
   s.header_mappings_dir    = "."
   s.compiler_flags         = folly_compiler_flags
   s.pod_target_xcconfig    = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"",

Hi I got this error too on react 0.69.0 and 0.69.1, the fact that I’m creating a bridge and turn on !use_framework to make a wrapper for MapBox Navigation SDK trow me that CallBackWrapper is not found and I tried any solution proposed and still got this error.

Did someone found how to fix this ?