react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Error 'ReactCommon/TurboModuleBinding.h' file not found on react native 0.72.0 on iOS

Open toscalivia83 opened this issue 1 year ago • 16 comments

Description

After upgrading my react native to version 0.72.0, I can't run my react native app on iOS properly as it logs an error saying: "Error 'ReactCommon/TurboModuleBinding.h' file" as show in the picture below.

I tried executing with the suggestions described here but unfortunately the error is still here.

Here is my 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, '13.0'

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

def fix_library_search_paths(installer)
  def fix_config(config)
    lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
    if lib_search_paths
      if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
        # since the libraries there are only built for x86_64 and i386.
        lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
        lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
          # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
          lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
        end
      end
    end
  end

  def __apply_Xcode_14_3_RC_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
        minimum_target = min_ios_version_supported
        if current_target.to_f < minimum_target.to_f
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
        end
      end
    end
  end

  projects = installer.aggregate_targets
    .map{ |t| t.user_project }
    .uniq{ |p| p.path }
    .push(installer.pods_project)

  projects.each do |project|
    project.build_configurations.each do |config|
      fix_config(config)
    end
    project.native_targets.each do |target|
      target.build_configurations.each do |config|
        fix_config(config)
      end
    end
    project.save()
  end
end

target 'Equitazone' do
  config = use_native_modules!

  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

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



  pod 'react-native-config/Extension', :path => '../node_modules/react-native-config'

  target 'EquitazoneTests' 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.
  # use_flipper!
  post_install do |installer|
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
      configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
    end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
        config.build_settings['CODE_SIGN_IDENTITY'] = ''
      end
    end
    fix_library_search_paths(installer)
    __apply_Xcode_14_3_RC_post_install_workaround(installer)
  end
end

target 'Equitazone-tvOS' do
  # Pods for Equitazone-tvOS

  target 'Equitazone-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

workspace 'Equitazone.xcworkspace'

React Native Version

0.72.0

Output of npx react-native info

System: OS: macOS 13.4 CPU: (8) arm64 Apple M1 Pro Memory: 89.31 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.2.0 path: /usr/local/bin/node Yarn: Not Found npm: version: 9.6.6 path: /usr/local/bin/npm Watchman: Not Found 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: - "28" - "29" - "30" - "31" - "32" - "33" Build Tools: - 29.0.2 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 33.0.0 - 34.0.0 System Images: - android-28 | Google APIs ARM 64 v8a - android-28 | Google ARM64-V8a Play ARM 64 v8a - android-29 | Google APIs ARM 64 v8a - android-29 | Google Play ARM 64 v8a - android-30 | Google APIs ARM 64 v8a - android-31 | Google Play ARM 64 v8a - android-32 | Google APIs ARM 64 v8a - android-33 | Google APIs ARM 64 v8a - android-33 | Google Play ARM 64 v8a Android NDK: 22.1.7171670 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: 3.2.2 path: /usr/local/opt/ruby/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.0 wanted: ^0.72.0 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: false newArchEnabled: false

Steps to reproduce

  • npm i
  • arch -x86_64 pod install (or tried with pod install only)
  • press run from Xcode on emulator or real device

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

Screenshot 2023-06-25 at 23 33 47

toscalivia83 avatar Jun 26 '23 11:06 toscalivia83

can you try using bundle install and bundle exec pod install? They should take care of using the right version of Cocoapods and dependencies, so that we are aligned to the same versions.

cipolleschi avatar Jun 26 '23 12:06 cipolleschi

bundle install worked as soon as I deletee the Gemfile.lock However when I run bundle exec pod install I get this error:

bundler: failed to load command: pod (/usr/local/lib/ruby/gems/3.2.0/bin/pod)
/usr/local/Cellar/ruby/3.2.2/lib/ruby/3.2.0/bundler/rubygems_integration.rb:308:in `block in replace_bin_path': can't find executable pod for gem cocoapods. cocoapods is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)

my ~/.zshrc looks like this:

source /Users/marion/.bash_profile

export PATH="/usr/local/bin:$PATH"
alias adb='/Users/marion/Library/Android/sdk/platform-tools/adb'

export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/marion/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/marion/google-cloud-sdk/path.zsh.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/marion/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/marion/google-cloud-sdk/completion.zsh.inc'; fi

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:/opt/gradle/gradle-8.1.1/bin
export PATH="/usr/local/opt/ruby/bin:$PATH"

Do you know how I can make it work? I'm trying to find how to add cocoapods into my Gemfile

toscalivia83 avatar Jun 26 '23 14:06 toscalivia83

I checked and cocoapods has been installed properly but I'm still having the same error @cipolleschi

toscalivia83 avatar Jun 26 '23 15:06 toscalivia83

Does it happens to you in a newly created project?

If you do npx react-native init NewProject --version latest and you try to build it, do you still have the Reactcommon/TurboModuleBinding.h file not found error?

I'm trying to understand what's going on, because I can't repro the issue.

cipolleschi avatar Jun 27 '23 10:06 cipolleschi

I tried creating a new repo, and I used npx react-native@latest init NewProject I guess that's what you meant. It seems the command changed recently

It works fine on another project indeed!

Don't really know what to change in my current project to make it work then 😬 Might be related to the usage of firebase?

toscalivia83 avatar Jun 27 '23 15:06 toscalivia83

Yep, very likely so. My suggestion now would be to start adding one change at the time and try pod install/build until we find what is breaking the build. At that point, we could be able to address the issue. How does it sound?

cipolleschi avatar Jun 29 '23 08:06 cipolleschi

I'm having the same problem, tried bundle install but it is not fixing it, if anyone has a clue

Lakston avatar Jul 07 '23 08:07 Lakston

I am also facing the same issue. Any workaround?

harouf avatar Jul 07 '23 08:07 harouf

I double checked that I disabled both hermes and fabric in my podfile:

    :hermes_enabled => false,
    :fabric_enabled => false,

so I dont know why turbomodules would be imported

node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h:18:9 'ReactCommon/TurboModule.h' file not found

I'm running 0.72.1

Lakston avatar Jul 07 '23 08:07 Lakston

Turbomodules are part of React Native and used by React Native even when the New Architecture is not fully enabled, that's why they are included.

Have you disabled Flipper? It is not compatible with use_frameworks!. Can you share your Podfile?

The best suggestion is to start with a fresh project and try to add one dep at the time to understand what breaks the app. We are running test in CI for a vanilla app with static frameworks and they are passing, so React Native works properly with that set up. There should be some dependency which is misconfigured.

cipolleschi avatar Jul 07 '23 09:07 cipolleschi

here is my podfile

$RNFirebaseAsStaticFramework = true
# 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!

# 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

use_frameworks! :linkage => :static

# Convert all permission pods into static libraries
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        # Uncomment the line corresponding to your CocoaPods version
        Pod::BuildType.static_library
        # Pod::Target::BuildType.static_library # < 1.9
      end
    end
  end
end

install! 'cocoapods', :deterministic_uuids => false

target 'AppName' do
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"
  pod 'Haptica'
  pod 'ffmpeg-kit-react-native', :subspecs => ['min-gpl'], :podspec => '../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec'
  
  config = use_native_modules!
  
  # 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 => false,
    :fabric_enabled => false,
    # 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}/.."
    )
    
  pod 'react-native-sms', :path => '../node_modules/react-native-sms'

  target 'AppNameTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

target 'AppName-tvOS' do
  # Pods for AppName-tvOS

  target 'AppName-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
      config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
  end
end

I just tried to run NO_FLIPPER=1 pod install and still having the same problem, also, is there a way to specify no flipper directly in the podfile ?

Lakston avatar Jul 07 '23 09:07 Lakston

Hi, ok, there are a couple of more things:

  1. In another issue, they mentioned that you can remove the pre-install hook. I tried to find it but I couldn't... :(
  2. You should move all the pod invocations AFTER the invocation of use_react_native!. We set some variables to make sure we can build with use_frameworks! and that could help
  3. One of the parameters of use_react_native! is :flipper_configuration. You can set that to FlipperConfiguration.disabled and it will be disabled without having to use NO_FLIPPER.

cipolleschi avatar Jul 07 '23 09:07 cipolleschi

  1. I'll look into that but not sure what part we're talking about exactly :) '
  2. I did, I'll post the updated podfile
  3. Yes I realised I could do that after posting my question!
$RNFirebaseAsStaticFramework = true
# 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!

# 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 = 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

use_frameworks! :linkage => :static

# Convert all permission pods into static libraries
pre_install do |installer|
  # Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        # Uncomment the line corresponding to your CocoaPods version
        Pod::BuildType.static_library
        # Pod::Target::BuildType.static_library # < 1.9
      end
    end
  end
end

install! 'cocoapods', :deterministic_uuids => false

target 'appname' do
  pod 'ffmpeg-kit-react-native', :subspecs => ['min-gpl'], :podspec => '../node_modules/ffmpeg-kit-react-native/ffmpeg-kit-react-native.podspec'   

  config = use_native_modules!
  
  # 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 => false,
    :fabric_enabled => false,
    # 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}/.."
    )

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"
  pod 'Haptica'
  pod 'react-native-sms', :path => '../node_modules/react-native-sms'

  target 'appnameTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'appname-tvOS' do
  # Pods for appname-tvOS

  target 'appname-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
      config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
  end
end

Lakston avatar Jul 07 '23 10:07 Lakston

could it be that the folder structure of our app has an extra folder ?

our folder structure is like this:

main folder
   -> front
      -> src
      -> ios
      -> node_modules
      -> etc...

so it could cause problems with this maybe ?

# 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

our folder structure has not changed and everything worked in previous versions, thagts the only change linked to flder structure in 0.72

Lakston avatar Jul 07 '23 12:07 Lakston

Ok I found the problem, hopefully if someone ends up here this will provide some pointers:

the problem came from the RN post install not being run, this part:

  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)
  end

I barely understand how RN works but it seems like config[:reactNativePath] not being run was causing the files not found problem

thanks @cipolleschi for your time, have a great day!

Lakston avatar Jul 07 '23 12:07 Lakston

Actually, in your podfile, you used to have:

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
      config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
  end
end

with no call to the react_native_post_install! function.

This is not really a React Native (RN) specific thing, but it is how React Native is integrated with Cocoapods (CP) .

CP is mainly used to install dependencies: you specify the dependencies needed in your project and CP downloads and install them, creating a separate Pods project and a workspace for your code to work with the new Pods project.

Then, there could be the need to customize the Pods project and the workspace. CP offers pre_install and post_install hooks to do these customisations.

RN exposes 2 functions:

  1. use_react_native to streamline the dependencies that an app needs from React Native itself. In this way we can encapsulate the complexity of adding all the RN dependencies
  2. react_native_post_install which is a post_install hook that is used to finalize the project and workspace with all the required flags and configurations. This function needs an installer object, so it has to be called in the post_install CP's hook.

Both functions must be called to have a properly initialized project.

I hope this helps to shed some light on how the framework works! :D

cipolleschi avatar Jul 07 '23 14:07 cipolleschi

@cipolleschi I have both use_react_native and react_native_post_install called properly, in right places. But still has this issue in both projects which uses ReactCommon/RCTTurboModule.h: react-native-quick-crypto and react-native-jsi-cpr I've tried to build with and without new architecture just to test - same issue. Also with new project it works properly somehow, but the difference is only the amount of Pods required in Podfile Do you have any other ideas what can I look at?

fmorau avatar Jul 25 '23 20:07 fmorau

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

github-actions[bot] avatar Jul 25 '23 20:07 github-actions[bot]

@chelovekdrakon I'm sorry that this is happening.

Also with new project it works properly somehow, but the difference is only the amount of Pods required in Podfile

If it is working with a newly created project, I think that the issue is in the local configuration of the podfile or of the project.

What are the differences between the two podfiles?

Alternatively, I can investigate the issue if you can create a reproducer using this repo.

The more likely issue is that:

  1. you are using statically linked frameworks
  2. some header is missing from the header search paths

cipolleschi avatar Jul 26 '23 09:07 cipolleschi

@cipolleschi thanks a lot for your empathy and willingness to help!

I could solve the issue by updating .podspec file of react-native-jsi-cpr : I had to remove s.dependency 'ReactCommon/turbomodule/core' and add s.dependency 'React' to make it work

With react-native-quick-crypto I found that we were launching one script which was needed in the past updating .podspec to replace s.dependency 'React' to 'React-core', so it ended up with two 'React-core' dependencies, which was the issue

Thanks a lot! Hope it might help somebody in future with similar issues to double check .podspec of libs they have such issue with :)

fmorau avatar Jul 27 '23 15:07 fmorau

Hi @chelovekdrakon I have a same error while upgrading expo from 48 to 49 'ReactCommon/RCTTurboModule.h' file not found

I created a seperate issue about that. Can you walk us through on how you solved the issue? Here's the link expo#23809

buscanopaul avatar Aug 03 '23 15:08 buscanopaul

@buscanopaul sure! I've explained everything above. I had to update .podspec file of libraries I had issues with for them to load all dependencies needed

fmorau avatar Aug 04 '23 07:08 fmorau

@chelovekdrakon would you mind open PRs on those repository with the fixes so that newer releases of the libraries would not suffer from this problem?

cipolleschi avatar Aug 08 '23 13:08 cipolleschi

@cipolleschi I worry, that it might break compatibility, because it worked for me before upgrade...

fmorau avatar Aug 08 '23 16:08 fmorau

@cipolleschi but Sure, I will 👍 👍 You only know, when you "measure" :)

fmorau avatar Aug 08 '23 16:08 fmorau

the thing is that we made some changes between 0.71 and 0.72 in the cocoapods setup in order to support use_frameworks in the New Architecture. So it was expected that some libraries would break and need an update. 😉

cipolleschi avatar Aug 08 '23 19:08 cipolleschi

I double checked that I disabled both hermes and fabric in my podfile:

    :hermes_enabled => false,
    :fabric_enabled => false,

so I dont know why turbomodules would be imported

node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h:18:9 'ReactCommon/TurboModule.h' file not found

I'm running 0.72.1

I have the same question.

my5201314zwl avatar Sep 07 '23 06:09 my5201314zwl

Ok I found the problem, hopefully if someone ends up here this will provide some pointers:

the problem came from the RN post install not being run, this part:

  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)
  end

I barely understand how RN works but it seems like config[:reactNativePath] not being run was causing the files not found problem

thanks @cipolleschi for your time, have a great day!

how to do ?

my5201314zwl avatar Sep 07 '23 06:09 my5201314zwl

Ok I found the problem, hopefully if someone ends up here this will provide some pointers: the problem came from the RN post install not being run, this part:

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

I barely understand how RN works but it seems like config[:reactNativePath] not being run was causing the files not found problem thanks @cipolleschi for your time, have a great day!

how to do ?

my podfile:

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!


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 'AwesomeP1' do
  config = use_native_modules!

  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
 
    :flipper_configuration => flipper_config,
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'AwesomeP1Tests' do
    inherit! :complete
  end

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

my5201314zwl avatar Sep 07 '23 06:09 my5201314zwl

Hello everyone, we have update the react version to 0.72 (We use Xcode 14.2) and we get the same issue like you. this our podfile post installer script

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ARCHS'] = '${ARCHS_STANDARD_64_BIT}'
      if target.name == "React"
        config.build_settings['ENABLE_BITCODE'] = 'NO'
      end
    end
    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_SIGNING_ALLOWED'] = 'NO'
      end
    end
    react_native_post_install(
        installer,
        config[:reactNativePath],
        :mac_catalyst_enabled => false
    )
  end
end

but sadly we get this error Capture d’écran 2023-10-03 à 15 10 08

I see that the issue is already open but maybe someone had fixed it hopefully.

regards :)

sassiwalid avatar Oct 03 '23 13:10 sassiwalid