react-native: iOS fails to run on version 0.72.1, 'react/debug/react_native_assert.h' file not found on RunLoopObserver.cpp (React-utils)

Description

I get the error: ‘react/debug/react_native_assert.h’ file not found, React-utils/RunLoopObserver. This is my Podfile:

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, '13.0'
prepare_react_native_project!

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled


dynamic_frameworks = [
    'Starscream',
    'iProov',
    'DatadogSDK',
    'SwiftProtobuf',
]
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if !dynamic_frameworks.include?(pod.name)
      puts "Overriding the static_framework? method for #{pod.name}"
      def pod.static_framework?;
        true
      end
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

target 'POK' do
  use_frameworks! :linkage => :static
  config = use_native_modules!
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    :flipper_configuration => FlipperConfiguration.disabled,
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'
  pod 'SRSRadialGradient', :path => '../node_modules/react-native-radial-gradient/ios'
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  $RNFirebaseAsStaticFramework = true

  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path

  target 'POKTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
        end
      end
      installer.generated_projects.each do |project|
        project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
          end
        end
      end
      `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_13_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
      path = "Pods/Target Support Files/Pods-POK/Pods-POK-frameworks.sh"
      lines = File.readlines(path)
      lines.insert(177, 'install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
      File.write(path, lines.join, mode: "w")
  end
end


### React Native Version

0.72.1

### Output of `npx react-native info`

System:
  OS: macOS 13.0
  CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  Memory: 74.79 MB / 32.00 GB
  Shell:
    version: 5.8.1
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.1
    path: ~/.nvm/versions/node/v18.16.1/bin/node
  Yarn:
    version: 1.22.18
    path: /usr/local/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.1/bin/npm
  Watchman:
    version: 2023.07.03.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK:
    API Levels:
      - "23"
      - "28"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
    Build Tools:
      - 28.0.3
      - 29.0.0
      - 29.0.2
      - 29.0.3
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
    System Images:
      - android-24 | Google Play Intel x86 Atom
      - android-29 | Intel x86 Atom_64
      - android-30 | Intel x86 Atom_64
      - android-30 | Google APIs Intel x86 Atom
      - android-30 | Google Play Intel x86 Atom
      - android-31 | Intel x86 Atom_64
      - android-33 | Google APIs Intel x86 Atom_64
      - android-33 | Google Play Intel x86 Atom_64
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.1
    wanted: 0.72.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

### Steps to reproduce

i migrated my app to a new clean version of a React native 0.72.1. i install my dependencies successfully using `yarn install`, then i run `pod install` successfully, but when i try to run the project on iOS, it throws me `'react/debug/react_native_assert.h' file not found` error.
Here's my package.json

{ “name”: “POK”, “version”: “0.0.1”, “private”: true, “scripts”: { “postinstall”: “patch-package”, “android”: “react-native run-android”, “ios”: “react-native run-ios”, “lint”: “eslint .”, “start”: “react-native start”, “test”: “jest” }, “dependencies”: { “@react-native-async-storage/async-storage”: “^1.19.0”, “@react-native-clipboard/clipboard”: “^1.11.2”, “@react-native-community/blur”: “^4.3.2”, “@react-native-community/netinfo”: “^9.4.1”, “@react-native-firebase/analytics”: “^18.1.0”, “@react-native-firebase/app”: “^18.1.0”, “@react-native-firebase/crashlytics”: “^18.1.0”, “@react-native-firebase/messaging”: “^18.1.0”, “@react-navigation/bottom-tabs”: “^6.5.8”, “@react-navigation/native”: “^6.1.7”, “@react-navigation/native-stack”: “^6.9.13”, “@react-navigation/stack”: “^6.3.17”, “axios”: “^1.4.0”, “buffer”: “^6.0.3”, “card-validator”: “^8.1.1”, “expo-modules-core”: “^1.5.4”, “fbjs”: “^3.0.5”, “isomorphic-webcrypto”: “^2.3.8”, “js-base64”: “^3.7.5”, “lodash”: “^4.17.21”, “lodash.compact”: “^3.0.1”, “lodash.every”: “^4.6.0”, “lodash.pick”: “^4.4.0”, “lodash.values”: “^4.3.0”, “lottie-ios”: “3.4.1”, “lottie-react-native”: “^5.1.6”, “moment-timezone”: “^0.5.43”, “patch-package”: “^7.0.0”, “postinstall-postinstall”: “^2.1.0”, “prop-types”: “^15.8.1”, “react”: “18.2.0”, “react-hook-form”: “^7.45.1”, “react-native”: “0.72.1”, “react-native-biometrics”: “^3.0.1”, “react-native-blob-util”: “^0.18.3”, “react-native-bootsplash”: “^4.7.4”, “react-native-calendars”: “^1.1299.0”, “react-native-camera”: “^4.2.1”, “react-native-confirmation-code-field”: “^7.3.1”, “react-native-contacts”: “^7.0.5”, “react-native-device-info”: “^10.7.0”, “react-native-fast-image”: “^8.6.3”, “react-native-flash-message”: “^0.4.1”, “react-native-flip-card”: “^3.5.7”, “react-native-geocoding”: “^0.5.0”, “react-native-geolocation-service”: “^5.3.1”, “react-native-gesture-handler”: “^2.12.0”, “react-native-google-places-autocomplete”: “^2.5.1”, “react-native-image-picker”: “^5.6.0”, “react-native-jumio-mobilesdk”: “https://github.com/Jumio/mobile-react.git#v4.5.0”, “react-native-keychain”: “^8.1.1”, “react-native-linear-gradient”: “^2.7.3”, “react-native-loading-spinner-overlay”: “^3.0.1”, “react-native-localization”: “^2.3.2”, “react-native-localize”: “^3.0.2”, “react-native-map-clustering”: “^3.4.2”, “react-native-maps”: “^1.7.1”, “react-native-masked-text”: “^1.13.0”, “react-native-mmkv”: “^2.10.1”, “react-native-modal”: “^13.0.1”, “react-native-modalize”: “^2.1.1”, “react-native-pdf”: “^6.7.1”, “react-native-permissions”: “^3.8.3”, “react-native-qrcode-scanner”: “^1.5.5”, “react-native-qrcode-svg”: “^6.2.0”, “react-native-radial-gradient”: “^1.1.3”, “react-native-radio-buttons”: “^1.0.0”, “react-native-reanimated”: “^3.3.0”, “react-native-safe-area-context”: “^4.6.4”, “react-native-screens”: “^3.22.1”, “react-native-skeleton-content-nonexpo”: “^1.0.13”, “react-native-svg”: “^13.9.0”, “react-native-toast-message”: “^2.1.6”, “react-native-vector-icons”: “^9.2.0”, “react-native-webview”: “^13.2.2”, “react-redux”: “^8.1.1”, “reanimated-bottom-sheet”: “^1.0.0-alpha.22”, “redux”: “^4.2.1”, “redux-logger”: “^3.0.6”, “redux-persist”: “^6.0.0”, “redux-thunk”: “^2.4.2”, “reselect”: “^4.1.8”, “socket.io-client”: “^4.7.1”, “validate.js”: “^0.13.1” }, “devDependencies”: { “@babel/core”: “^7.20.0”, “@babel/preset-env”: “^7.20.0”, “@babel/runtime”: “^7.20.0”, “@react-native/eslint-config”: “^0.72.2”, “@react-native/metro-config”: “^0.72.7”, “@tsconfig/react-native”: “^3.0.0”, “@types/metro-config”: “^0.76.3”, “@types/react”: “^18.0.24”, “@types/react-test-renderer”: “^18.0.0”, “babel-jest”: “^29.2.1”, “babel-plugin-module-resolver”: “^5.0.0”, “eslint”: “^8.19.0”, “eslint-plugin-import”: “^2.27.5”, “jest”: “^29.2.1”, “metro-react-native-babel-preset”: “0.76.5”, “prettier”: “^2.4.1”, “react-native-svg-transformer”: “^1.0.0”, “react-test-renderer”: “18.2.0”, “typescript”: “4.8.4” }, “engines”: { “node”: “>=16” } }

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

Screenshot 2023-07-11 at 11 01 12 AM

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 10
  • Comments: 85 (19 by maintainers)

Most upvoted comments

@cipolleschi I’ve been investigating further, and finally find out that this problem might have something to do with monorepo structure. My workspace is managed by Nx (monorepo tool). Nx’s way to manage ReactNative app as a sub project, specificaly to have a symlink inside sub project directory to root node_modules directory, is causing the build error. I’m not sure this is a problem on React Native itself, or Nx’s one, but I’m sharing the reproduction repository here. https://github.com/mokoshi/rn-repro

Related issue which is on Nx’s repository: https://github.com/nrwl/nx/issues/20115

The full snippet is below

After further testing while this resolves the react/debug/react_native_assert.h I am now getting another error for React-NativeModulesApple --> 'ReactCommon/TurboModuleBinding.h' file not found.

Seems like other folks who have use_frameworks! are getting the later as well. https://github.com/react-native-tvos/react-native-tvos/issues/575

Edit: After further debugging this seems to be an issue with the recent 0.72.5 release. 0.72.4 works for me on XCode 14.3.1 & 15, but 0.72.5 leads to the above errors.

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )

    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if ["React-cxxreact", "React-utils", "React-NativeModulesApple"].any? { |t| t == target.name }
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << "${PODS_ROOT}/../../node_modules/react-native/ReactCommon"
        end
      end
    end
  end

@mokoshi Symlink support was experimental in 0.72 and is now stable in 0.73.

We know that React Native does not behaves very well in monorepo setups, but we are working to improve the situation.

Good news, I understood the problem. Bad news, this is an issue with react-native-image-picker.

This is the PR that fixes. You can apply it to your node_modules while the maintainer release a new version (or any other patching mechanism).

Aaaaaanyway, the technical bits if you are interested.

  • Since we started working on the New Architecture, React Native is a C++/Objective-C++ project
  • C++ and Swift don’t like each other
  • react-native-image-picker make use of a Swift @import statement here (why? I have no clue! ¯_(ツ)_/¯)
  • this means that as soon as a file in library tries to import something from React Native the file resolution will fail as soon as it enocunter a C++ symbol. In our case the RunLoopObserver.h

you can see here i’am success

and you can type npx react-native doctor

https://github.com/facebook/react-native/issues/38140

I solved the problem. Add these code blocks to Podflie

installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if [
          "React-cxxreact",
          "React-utils",
          "React-NativeModulesApple",
          "React-jserrorhandler",
          "React-ImageManager",
          "React-graphics",
          "React-Fabric",
          "ReactCommon",
          "RNReanimated",
          "React-Codegen",
          "React-RCTNetwork",
          "React-RCTVibration",
          "React-RCTSettings",
          "React-RCTLinking",
          "React-RCTAnimation",
          "React-RCTImage",
          "React-RCTBlob",
          "React-CoreModules",
          "React-RCTAppDelegate"
        ].any? { |t| t == target.name }
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << "${PODS_ROOT}/../../node_modules/react-native/ReactCommon "
          config.build_settings["HEADER_SEARCH_PATHS"] << "${PODS_ROOT}/../../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ "
          config.build_settings["HEADER_SEARCH_PATHS"] << "${PODS_ROOT}/../../node_modules/react-native/ReactCommon/react/nativemodule/core/ "
        end
   end
end

I disabled flipper and i tried this solution https://github.com/nrwl/nx/issues/20115#issuecomment-1895965371 but still same 😦 @Slapbox

I am using use_framework! and

dynamic_frameworks = [
    'TensorFlowLiteSwift',
  ] # <- swift libraries names
    # Make all the other frameworks into static frameworks by overriding the static_framework? function to return true
  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if !dynamic_frameworks.include?(pod.name)
        def pod.static_framework?;
          true
        end
        def pod.build_type;
          Pod::BuildType.static_library
        end
      end
    end
  end

@Slapbox i tried your solution but still same error

Thank you for your help. I’m trying to create a minimum reproducible example from each side, my own repository and the empty project. I will share here if I create that successfully.

@wkwyatt Your problem is probably different from the react-native-image-picker.

To help you out I need the exact list of dependencies you are using. The most likely cause is that there is a dependency that is not properly configured that is trying to access the TurboModuleBinding.h files without having it in its own search_path. Thus, the dependency don’t find the file and it shows the error. Therefore, the app fails to build.

However, there are 1309 libraries that have React Native as their dependency. Many of them are deprecated or unmaintained. I can’t try and fix them all, so, please, provide a reproducer with your dependencies.

@vksgautam1986 I’m investigating the issue. I cleaned up a little the Podfile, this is the correct version: https://github.com/vksgautam1986/RnIssue/pull/1

After that, I started investigating the issue. I found that the culprit is react-native-image-picker which seems to be not compatible with use_frameworks! Once I remove it with yarn remove react-native-image-picker it then works seamlessly.

I’m now trying to understand what makes react-native-image-picker fail so badly and I’m looking for a solution.

I am encountering the same issue. Tried both RN 0.72.4 and 0.72.6 and all the workarounds from here.

There is still React-NativeModulesApple --> 'ReactCommon/TurboModuleBinding.h' file not found after adding the workaround in pods:

    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        if ["React-NativeModulesApple", "React-cxxreact", "RNGestureHandler", "RNScreens", "React-utils", "React-runtimescheduler", "StreamAMGSDK/PlayKit"].any? { |t| t == target.name }
          config.build_settings["HEADER_SEARCH_PATHS"] ||= "$(inherited) "
          config.build_settings["HEADER_SEARCH_PATHS"] << "${PODS_ROOT}/../../node_modules/react-native/ReactCommon"
        end
      end
    end

  end

Screenshot 2023-11-16 at 18 06 35

+1

LE: Fixed by using https://github.com/software-mansion/react-native-svg/issues/2081#issuecomment-1691758876 Make sure you pass the libraries that complain

if ["React-cxxreact", "React-NativeModulesApple", "RNGestureHandler", "RNScreens", "React-utils", "React-runtimescheduler"].any? { |t| t == target.name }
	append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon")
end

Need help . all the RN project failing to install pod

here is the log

` [!] Error installing hermes-engine

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Command

/usr/local/Cellar/cocoapods/1.15.0/libexec/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.15.0
        Ruby : ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]
    RubyGems : 3.5.4
        Host : macOS 14.2 (23C64)
       Xcode : 15.1 (15C65)
         Git : git version 2.39.3 (Apple Git-145)
Ruby lib dir : /usr/local/Cellar/ruby/3.3.0/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!
$RNMapboxMapsVersion = '= 11.0.0'
# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'cargo' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'cargoTests' do
    inherit! :complete
    # Pods for testing
  end
  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
  end
  post_install do |installer|
    $RNMapboxMaps.post_install(installer)
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
  end
end

Error

Errno::EEXIST - File exists @ syserr_fail2_in - /Users/imac/Library/Caches/CocoaPods/Pods/External/hermes-engine/0e37d787f1d5a7b711e72349208731c3-34df9/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/Resources
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2254:in `symlink'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2254:in `copy'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:1048:in `block in copy_entry'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2385:in `wrap_traverse'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2388:in `block in wrap_traverse'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2387:in `each'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2387:in `wrap_traverse'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:1045:in `copy_entry'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:990:in `block in cp_r'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2469:in `block in fu_each_src_dest'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2478:in `block in fu_each_src_dest0'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2476:in `each'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2476:in `fu_each_src_dest0'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:2467:in `fu_each_src_dest'
/usr/local/Cellar/ruby/3.3.0/lib/ruby/3.3.0/fileutils.rb:989:in `cp_r'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:343:in `block (2 levels) in copy_files'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:341:in `each'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:341:in `block in copy_files'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:128:in `lock'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:99:in `write_lock'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:332:in `copy_files'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:269:in `block (2 levels) in uncached_pod'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:265:in `each'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:265:in `block in uncached_pod'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:291:in `in_tmpdir'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:238:in `uncached_pod'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/downloader.rb:42:in `download'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer/pod_source_downloader.rb:69:in `download!'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer/pod_source_installer.rb:117:in `download_source'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer/pod_source_installer.rb:67:in `install!'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:621:in `install_source_of_pod'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:539:in `block (2 levels) in install_pod_sources'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/user_interface.rb:86:in `titled_section'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:538:in `block in install_pod_sources'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:535:in `each'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:535:in `install_pod_sources'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:258:in `block in download_dependencies'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:257:in `download_dependencies'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/installer.rb:163:in `install!'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/command/install.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.15.0/libexec/gems/cocoapods-1.15.0/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.15.0/libexec/bin/pod:25:in `load'
/usr/local/Cellar/cocoapods/1.15.0/libexec/bin/pod:25:in `<main>'

`

There are a few things we can do:

  1. To identify which library is causing the issue, you can either: a. Start a new project and gradually add dependencies until it break b. Or, from your current project, start removing one dep after the other and se when start working again.
  2. If you can provide a reproducer starting from this repo, i can try to see if we can develop a patch for Yoga.

If you plan to integrate your library into a React Native app, you still have to use the tool above, because the podspec and podfile needs to call the React Native specific hooks. In that case, you can leave the JS side of the library empty.

We do a lot of work on Cocoapods under the hood so that users don’t have to run manual changes on the projects. We also have auto-linking so that a user just have to yarn add <yourlibrary> and it does not need to modify the Podfile.

I don’t know what’s the extent of the library you are developing, but in the React Native community the expectation is that users don’t have to touch native code, if possible.

Thank you so much! PSA: I’ll be on PTO from tomorrow until the 12th of December (6-7 working days). I hope this would not be a major issue.

IIUC, you are building the reproducer with a static framework setup. 🤔 We have tests in CI for the framework setup and they are passing. So I’m a bit skeptical that this is the root problem, but it can be a way in which it manifest.

Can I ask you to create a reproducer by:

  1. cloning the reproducer template
  2. apply the changes the you need to make the error appear (the react_native_assert.h not found one)
  3. commit those changes?

In that way I can download the code and investigate. What I think is happening is another dependency that is not properly configured which is not depending on React-debug which exposes the react_native_assert.h header.

Thank you for the instructions @cipolleschi !

  1. Does the issue reproduce when you create a new empty app with React Native 0.72.7?

Probably yes…? First of all, I can build the reproducer repo. Additional information:

  • Adding react-native-image-picker@7.0.3 is still not an problem. It successfully builds.
  • Modifying Podfile as below cause a build error.
Podfile diff
diff --git a/ReproducerApp/ios/Podfile b/ReproducerApp/ios/Podfile
index 403498b..60e84a7 100644
--- a/ReproducerApp/ios/Podfile
+++ b/ReproducerApp/ios/Podfile
@@ -17,7 +17,8 @@ prepare_react_native_project!
 #   dependencies: {
 #     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
 # ```
-flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
+# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
+flipper_config = FlipperConfiguration.disabled
 
 linkage = ENV['USE_FRAMEWORKS']
 if linkage != nil
@@ -27,6 +28,7 @@ end
 
 target 'ReproducerApp' do
   config = use_native_modules!
+  use_frameworks! :linkage => :static
 
   # Flags change depending on the env values.
   flags = get_default_flags()

(The error is not the same as this GitHub issue focuses on 🤔 )

/Users/mokoshi/projects/reproducer-react-native/ReproducerApp/node_modules/react-native/React/Base/RCTRuntimeExecutorFromBridge.h:10:9: error: include of non-modular header inside framework module 'React.RCTRuntimeExecutorFromBridge': '/Users/mokoshi/projects/reproducer-react-native/ReproducerApp/ios/Pods/Headers/Public/React-runtimeexecutor/ReactCommon/RuntimeExecutor.h'
/Users/mokoshi/projects/reproducer-react-native/ReproducerApp/node_modules/react-native-image-picker/ios/ImagePickerManager.h:1:9: Could not build module 'React'
  1. can you run: …

I followed your instructions, but still having the same error: react_native_assert.h not found

  1. Can you share your podfile?
Here is my podfile:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip
require_relative '../node_modules/react-native-permissions/scripts/setup'

platform :ios, min_ios_version_supported
prepare_react_native_project!
setup_permissions([
  'Camera',
  'Notifications',
  'PhotoLibrary',
])


# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
flipper_config = FlipperConfiguration.disabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

project 'MyApp',
    'Debug' => :debug,
    'Release' => :release,
    'Local' => :debug,
    'Dev' => :release,
    'Prod' => :release

target 'MyApp' do
  config = use_native_modules!

  # for react-native-firebase
  use_frameworks! :linkage => :static

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

  use_react_native!(
    :path => config[:reactNativePath],

    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # react-native-config
    setup_envfiles(installer)
  end
end

ENVFILES = {
  'Local' => '$(PODS_ROOT)/../../.env.local.ios',
  'Dev' => '$(PODS_ROOT)/../../.env.dev',
  'Prod' => '$(PODS_ROOT)/../../.env.prod'
}
def setup_envfiles(installer)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'react-native-config'
        config.build_settings['ENVFILE'] = ENVFILES[config.name]
      end
    end
  end
end

Good news, I understood the problem. Bad news, this is an issue with react-native-image-picker.

This is the PR that fixes. You can apply it to your node_modules while the maintainer release a new version (or any other patching mechanism).

Aaaaaanyway, the technical bits if you are interested.

  • Since we started working on the New Architecture, React Native is a C++/Objective-C++ project
  • C++ and Swift don’t like each other
  • react-native-image-picker make use of a Swift @import statement here (why? I have no clue! ¯_(ツ)_/¯)
  • this means that as soon as a file in library tries to import something from React Native the file resolution will fail as soon as it enocunter a C++ symbol. In our case the RunLoopObserver.h

thanks fix is working fine for me and i have patched the image picker fix as well and thanks for the technical explination of the issue. Now it’s more clear about things

If you are using react-native-image-picker, the reason is that that library is using a Swift import that is not compatible. When the libraries are loaded and react-native-image-picker is loaded, the resolution fails at the first c++ symbol encountered. The suggested patch removed the Swift import, therefore fixing the incompatibility.

Otherwise, TurboModuleBinding is another issue. It wasn’t happening in the repro provided by @vksgautam1986

If you had that failure, please provide a repro with the dependencies you are using. React Native builds properly with use_frameworks! And it works with Firebase. If you are seeing that error is because either the Podfile you are using is tampering with the the dependencies setup or there is another dependency that is causing issues.

I need to look into the specifics and I need a repro with all your deps.

I’ll have a look at it tomorrow! Thanks for the repro @vksgautam1986 Can you also invite me as a collaborator, so I can make changes and share them with you more easily?

Thanks , i have invited you

@cipolleschi please post the fixed changes here I am having the same issue

I’ll have a look at it tomorrow! Thanks for the repro @vksgautam1986 Can you also invite me as a collaborator, so I can make changes and share them with you more easily?

Just ran into the same issue when adding RN Firebase to project and adding use_frameworks! :linkage => :static. Can confirm downgrading RN to 0.72.4 resolves the issue. Also may be worth mentioning I’m using pnpm and started my project on 0.72.3 version.

On 0.72.6 the workaround from @enchorb fixed this specific issue for me, but lead to other import problems, finally I got stuck on error resolving FLT_MAX constant.

Downgrading to 0.72.4 (from 0.72.5) and upgrading the XCode from 14.3.2 to 15 fixed it for me without changing the Podfile.

After having been blocked many days, my issue was finally fixed by this: software-mansion/react-native-svg#2081 (comment)

Hi! Can you please guide me on how you resolve this? I added the following code in my pod but I am still getting the same error: installer.pods_project.targets.each do |target| if ["React-cxxreact", "React-NativeModulesApple", "RNGestureHandler", "RNScreens", "React-utils", "React-runtimescheduler"].any? { |t| t == target.name } append_header_search_path(target, "${PODS_ROOT}/../../node_modules/react-native/ReactCommon") end end