During the process of updating RN to 0.73. I am running into this issue on the app center ios pipeline.
ld: Undefined symbols: _OBJC_CLASS_$_RCTEventDispatcher, referenced from: __OBJC_$_CATEGORY_RCTEventDispatcher_$_Reanimated in libRNReanimated.a[15](RCTEventDispatcher+Reanimated.o) in libreact-native-video.a[14](RCTVideoManager-4f7ca5ff0fe771e512e596f87e56773d.o)clang: error: linker command failed with exit code 1 (use -v to see invocation)
The following build commands failed: Ld /Users/runner/Library/Developer/Xcode/DerivedData/fluzclient-giqtbliqeqmefvddlqenjaszepez/Build/Intermediates.noindex/ArchiveIntermediates/fluzclient/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/ImageNotification.appex/ImageNotification normal (in target 'ImageNotification' from project 'fluzclient')(1 failure)##[error]Error: /usr/bin/xcodebuild failed with return code: 65
My podfile
# Resolve react_native_pods.rb with node to allow for hoistinguse_modular_headers!def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p',"require.resolve('#{script}', {paths: [process.argv[1]]}, )", __dir__]).stripendnode_require('react-native/scripts/react_native_pods.rb')node_require('react-native-permissions/scripts/setup.rb')ENV['SWIFT_VERSION'] = '5.7'def fluz_pods pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker' pod 'react-native-branch', path: '../node_modules/react-native-branch' pod 'FullStory', :http => 'https://ios-releases.fullstory.com/fullstory-1.43.1-xcframework.tar.gz' pod 'CocoaLumberjack/Swift'endplatform :ios, '14.0'prepare_react_native_project!setup_permissions(['AppTrackingTransparency','Bluetooth','Calendars','CalendarsWriteOnly','Camera','Contacts','FaceID','LocationAccuracy','LocationAlways','LocationWhenInUse','MediaLibrary','Microphone','Motion','Notifications','PhotoLibrary','PhotoLibraryAddOnly','Reminders','SpeechRecognition','StoreKit',])# 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.enabledlinkage = ENV['USE_FRAMEWORKS']if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_symenddef guard_pods_deployment_target(installer) # implements __apply_Xcode_12_5_M1_post_install_workaround with ios 12.0 installer.pods_project.targets.each do |target| if target.name != "Braintree" # we skip Braintree packages for target upgrade # "error: 'unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0" target.build_configurations.each do |config| # "error: thread-local storage is not supported for the current target" # The most reliable known workaround is to bump iOS deployment target. # ensure IPHONEOS_DEPLOYMENT_TARGET is at least 14 should_upgrade = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].split('.')[0].to_i < 14 if should_upgrade config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14' end end end if target.name == "Braintree" # apply only to Braintree to prevent # "error: 'unarchiveObjectWithData:' is deprecated: first deprecated in iOS 12.0" target.build_configurations.each do |config| # "error: thread-local storage is not supported for the current target" # The most reliable known workaround is to bump iOS deployment target. # ensure IPHONEOS_DEPLOYMENT_TARGET is at least 14.0 should_upgrade = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].split('.')[0].to_i < 14.0 if should_upgrade config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0' end end end if target.name == 'Flipper' file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h' contents = File.read(file_path) unless contents.include?('#include <functional>') File.open(file_path, 'w') do |file| file.puts('#include <functional>') file.puts(contents) end end end end # But... doing so caused another issue in Flipper: # "Time.h:52:17: error: typedef redefinition with different types" # We need to make a patch to RCT-Folly. @0.66.3 # See https://github.com/facebook/flipper/issues/834 for more details. `sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_14_0)//' Pods/RCT-Folly/folly/portability/Time.h`endtarget 'fluzclient' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! 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}/.." ) # Pods for fluzclient fluz_pods target 'fluzclientTests' do inherit! :complete # Pods for testing endendtarget 'fluzclient-staging' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! 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}/.." ) # Pods for fluzclient fluz_podsendconfig = use_native_modules!pre_install do |installer| installer.pod_targets.each do |pod| if pod.name.eql?('RNReanimated') def pod.build_type Pod::BuildType.static_library end end endendpost_install do |installer| installer.pods_project.targets.each do |target| if target.name == "React-Core.common-CoreModulesHeaders-RCTI18nStrings" target.remove_from_project end target.build_configurations.each do |config| config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO' end end # 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 ) guard_pods_deployment_target(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION'] end endendtarget 'ImageNotification' do platform :ios, '14.0' pod 'Firebase/Messaging' pod 'Iterable-iOS-AppExtensions'end
Many people say that it is related to use_framework and that adding a pre_install with a explicit type to static library would fix it but it did not for me. I am pretty sure that RNReanimated is what i need to target but am i wrong?
pre_install do |installer| installer.pod_targets.each do |pod| if pod.name.eql?('RNReanimated') def pod.build_type Pod::BuildType.static_library end end end end
- I have also tried removing
use_modular_headers!
- upgrading react-native-video but I end up getting a different error.
- upgrading react-native-reanimated
- adding RNReanimated to the ImageNotification target like below
target 'ImageNotification' do platform :ios, '14.0' pod 'Firebase/Messaging' pod 'Iterable-iOS-AppExtensions' pod 'RNReanimated'end