facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.1k stars 24.32k forks source link

[iOS][0.70.5] react/bridging/CallbackWrapper.h and LongLivedObject.h file not found when building ReactCommon #35898

Closed ste7en closed 1 year ago

ste7en commented 1 year ago

Description

I'm trying to build my iOS project using static frameworks as required by the Firebase SDK. The react-native version I have is 0.70.5 as required by Expo SDK 47. When building ReactCommon, this error appears:

▸ Compiling TurboModuleUtils.cpp

❌  /node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h:16:10: 'react/bridging/CallbackWrapper.h' file not found

#include <react/bridging/CallbackWrapper.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

▸ Compiling TurboModuleBinding.cpp

❌  /node_modules/react-native/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.h:11:10: 'react/bridging/LongLivedObject.h' file not found

#include <react/bridging/LongLivedObject.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It looks similar to #34102 but the issue was marked as solved by 0.69.3.

Version

0.70.5

Output of npx react-native info

System:
    OS: macOS 13.0.1
    CPU: (8) arm64 Apple M2
    Memory: 394.98 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
    Watchman: 2023.01.09.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/stefano.formicola/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9477386
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: 9.3.2 => 9.3.2 
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.5 => 0.70.5 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

The issue appears with a Podfile like this, using the flag use_frameworks! :linkage => :static as required by the Firebase SDK:

Podfile ```rb require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules") require File.join(File.dirname(`node --print "require.resolve('@nrwl/react-native/package.json')"`), "nx_post_install") platform :ios, '13.0' install! 'cocoapods', :deterministic_uuids => false project 'App', 'Debug Staging' => :debug, 'Release Staging' => :release, 'Debug Production' => :debug, 'Release Production' => :release, 'AppStore' => :release def shared_pods google_utilites pod 'FBSDKCoreKit', '12.1.0' pod 'FBSDKLoginKit', '12.1.0' pod 'Cosmos', '~> 23.0' pod 'Firebase/Crashlytics', '~> 8.15.0' pod 'Firebase/Messaging', '~> 8.15.0' pod 'Firebase/DynamicLinks', '~> 8.15.0' pod 'Firebase/Performance', '~> 8.15.0' pod 'Firebase/Analytics', '~> 8.15.0' pod 'GoogleSignIn', '6.0.2' pod 'Auth0', '~> 2.3' pod 'CryptoSwift', '1.4.0' pod 'Alamofire', '4.8.1' pod 'SwiftyBeaver', '1.9.5' pod 'ObjectMapper', '3.5.1' pod 'Connectivity', '5.0.0' pod 'Kingfisher', '5.4.0' pod 'UIColor_Hex_Swift', '4.2.0' pod 'SwiftJWT' pod 'ZendeskSupportSDK', '5.0.3' pod 'AlamofireObjectMapper', '5.2.0' pod 'Presentr', '1.9' pod 'SDVersion', '4.3.2' pod 'ReCaptcha', '1.6.0' pod 'UICircularProgressRing', '6.5.0' pod 'google-cast-sdk-no-bluetooth', '4.5.2' pod 'InstantSearch', '~> 5.0' pod 'InstantSearch/Core' pod 'VisualEffectView', '4.1.3' pod 'lottie-ios', '~> 3.5.0' pod 'Charts' pod 'Mixpanel-swift', '3.2.2' pod 'LaunchDarkly', '~> 7.1.0' end def google_utilites pod 'GoogleUtilities/AppDelegateSwizzler' pod 'GoogleUtilities/Environment' pod 'GoogleUtilities/ISASwizzler' pod 'GoogleUtilities/Logger' pod 'GoogleUtilities/MethodSwizzler', '7.7' pod 'GoogleUtilities/NSData+zlib' pod 'GoogleUtilities/Network' pod 'GoogleUtilities/Reachability' pod 'GoogleUtilities/UserDefaults' pod 'Apollo', '0.53.0' pod 'Apollo/SQLite', '0.53.0' end def react_native_pods_install # Flags change depending on the env values. flags = get_default_flags() production = ENV['PRODUCTION'] == "1" use_expo_modules! config = use_native_modules! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :production => production, :hermes_enabled => false, :fabric_enabled => false, :flipper_configuration => FlipperConfiguration.disabled, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) end abstract_target 'BasePods' do use_frameworks! :linkage => :static # If you use `use_frameworks!` in your Podfile, # uncomment the below $static_framework array and also # the pre_install section. This will cause Flipper and # it's dependencies to be built as a static library and all other pods to # be dynamic. # # NOTE Doing this may lead to a broken build if any of these are also # transitive dependencies of other dependencies and are expected # to be built as frameworks. # # $static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly', # 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion', # 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit', # 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native', 'Flipper-Fmt' # ] # # 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 post_install do |installer| react_native_post_install(installer, # Set `mac_catalyst_enabled` to `true` in order to apply patches # necessary for Mac Catalyst builds :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) installer.pods_project.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' end # This is necessary for Xcode 14, because it signs resource bundles by default # when building for devices. installer.target_installation_results.pod_target_installation_results .each do |pod_name, target_installation_result| target_installation_result.resource_bundle_targets.each do |resource_bundle_target| resource_bundle_target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end nx_post_install(installer) end post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end target 'App' do config = use_native_modules! react_native_pods_install shared_pods end target 'AppWidget' do google_utilites pod 'Alamofire', '4.8.1' pod 'SwiftJWT' pod 'Auth0', '~> 2.3' pod 'SDVersion', '4.3.2' pod 'Connectivity', '5.0.0' pod 'SwiftyBeaver', '1.9.5' pod 'Firebase/Crashlytics', '~> 8.15.0' pod 'Firebase/Analytics', '~> 8.15.0' end target 'AppWidgetExtension' do google_utilites pod 'Alamofire', '4.8.1' pod 'SwiftJWT' pod 'Auth0', '~> 2.3' pod 'SDVersion', '4.3.2' pod 'Connectivity', '5.0.0' pod 'SwiftyBeaver', '1.9.5' pod 'Firebase/Crashlytics', '~> 8.15.0' pod 'Firebase/Analytics', '~> 8.15.0' end end ```

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

N/A

kennethlynne commented 1 year ago

Relevant issue in the react-native-firebase repo: https://github.com/invertase/react-native-firebase/issues/6800

aureliopetrone commented 1 year ago

Same issue here. Have you solved it @kennethlynne?

ste7en commented 1 year ago

@aureliopetrone solved with this patch react-native@0.70.6.patch

I applied this using pnpm as package manager but I guess you could easily apply it with yarn or git diff as well!