-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to Build for IOS after enabling new architecture, #37102
Comments
cc @cipolleschi |
Hi @kaushal9808, thanks for the issue. Could you please provide a reproducer? I tried to create a new app, install the pods and build with Xcode 14.3 as you suggested, but new apps build fine, so I guess there is something specific of your setup... What I run:
⌘ + r |
we have migrated our app from RN - 0.67.0 version to 0.71.7, Android and IOS version without new architecture working fine, Could you please share ruby version with using -> npx react-native info we can check that if that will create issues or not. |
version 0.71.7 dropped any requirement for Ruby. Everything should work from version 2.6.10, shipped with the Macbook to version 3.2.0. We also have test in CircleCI that builds React Native in a new app from the template using Ruby 2.7.7 (latest Ruby 2 stable) and Ruby 3.2.0. Personally, my global ruby version, through Can you share the |
Hello , for PodFile reference, I have copy paste it here . and I have reinstall pods multiple times after removing cache as well. require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
platform :ios, min_ios_version_supported
prepare_react_native_project!
ENV['RCT_NEW_ARCH_ENABLED'] = "1"
# 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 'XXXX' do
config = use_native_modules!
# For extensions without React dependencies
pod 'react-native-config', :path => '../node_modules/react-native-config'
# 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.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
: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 'XXXX' do
inherit! :complete
# Pods for testing
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
)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
################### ADD THE FOLLOWING #########################
installer.pods_project.targets.each do |target|
if target.name == "React-Core.common-AccessibilityResources"
target.remove_from_project
end
end
###############################################################
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end |
I think I got the problem. The error reports that the If we look at the What's happening is that the flag is not propagated to the pod, so those symbols are actually excluded from the build. This code should make sure that those flag are set, but there could be a bug there. Or there could be some other pieces of infra that tinkers with the C/CXX flags we are setting up. To double check that that's the problem, you can:
|
That's effectively weird. I don't know how's possible that you have two React-Core... 😅 |
@cipolleschi It is very possible to have two React-Core if you have multiple targets, as we do for the TV repo. In this case, instead of just 'React-Core', we have 'React-Core-iOS' and 'React-Core-tvOS'. This patch fixed the issue for me. If you agree that this is reasonable, I can open a PR to the core repo. diff --git a/node_modules/react-native/scripts/cocoapods/new_architecture.rb b/node_modules/react-native/scripts/cocoapods/new_architecture.rb
index 90141cd..6ef1de9 100644
--- a/node_modules/react-native/scripts/cocoapods/new_architecture.rb
+++ b/node_modules/react-native/scripts/cocoapods/new_architecture.rb
@@ -16,7 +16,7 @@ class NewArchitectureHelper
language_standard = nil
installer.pods_project.targets.each do |target|
- if target.name == 'React-Core'
+ if target.name.include? 'React-Core'
language_standard = target.resolved_build_setting("CLANG_CXX_LANGUAGE_STANDARD", resolve_against_xcconfig: true).values[0]
end
end
@@ -54,7 +54,7 @@ class NewArchitectureHelper
# Add RCT_NEW_ARCH_ENABLED to generated pod target projects
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
- if pod_name == 'React-Core'
+ if pod_name.include? 'React-Core'
target_installation_result.native_target.build_configurations.each do |config|
config.build_settings['OTHER_CPLUSPLUSFLAGS'] = @@new_arch_cpp_flags
end |
@douglowder as temporary patch/fixes, would you mind set up a PR for this? 🙏 |
…targets (#37581) Summary: In Xcode projects with multiple targets, and in particular when targets are for different platforms (e.g. iOS and macOS), Cocoapods may add a suffix to a Pod name like `React-Core`. When this happens, the code in `new_architecture.rb` (which was looking for a pod with exact name `React-Core`) would not add the preprocessor definitions for Fabric as expected. This change fixes this issue. Fixes #37102 . ## Changelog: [iOS] [Fixed] - Fix Fabric issue with React-Core pod when Xcode project has multiple targets Pull Request resolved: #37581 Test Plan: Tested that this change fixes this issue which occurs 100% of the time in React Native TV projects. Reviewed By: dmytrorykun Differential Revision: D46264704 Pulled By: cipolleschi fbshipit-source-id: 8dfc8e342b5a110ef1f028636e01e5c5f2b6e2f0
…targets (facebook#37581) Summary: In Xcode projects with multiple targets, and in particular when targets are for different platforms (e.g. iOS and macOS), Cocoapods may add a suffix to a Pod name like `React-Core`. When this happens, the code in `new_architecture.rb` (which was looking for a pod with exact name `React-Core`) would not add the preprocessor definitions for Fabric as expected. This change fixes this issue. Fixes facebook#37102 . ## Changelog: [iOS] [Fixed] - Fix Fabric issue with React-Core pod when Xcode project has multiple targets Pull Request resolved: facebook#37581 Test Plan: Tested that this change fixes this issue which occurs 100% of the time in React Native TV projects. Reviewed By: dmytrorykun Differential Revision: D46264704 Pulled By: cipolleschi fbshipit-source-id: 8dfc8e342b5a110ef1f028636e01e5c5f2b6e2f0
Description
We are using react native 0.71.7 version without enabling new architecture its working fine for both platform android and ios.
But After Enabling New Architecture build failing for Ios, Android Build working fine.
we are getting linking error
Undefined symbols for architecture x86_64:
"_RCTAppSetupDefaultModuleFromClass", referenced from:
-[RCTAppDelegate getModuleInstanceFromClass:] in libReact-RCTAppDelegate.a(RCTAppDelegate.o)
"RCTAppSetupDefaultJsExecutorFactory(RCTBridge*, RCTTurboModuleManager*)", referenced from:
-[RCTAppDelegate jsExecutorFactoryForBridge:] in libReact-RCTAppDelegate.a(RCTAppDelegate.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
React Native Version
0.71.7
Output of
npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 13.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 897.02 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 19.9.0 - /usr/local/bin/node
Yarn: Not Found
npm: 9.6.3 - /usr/local/bin/npm
Watchman: 2023.04.10.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.12.0 - /Users/XYZ/.rvm/gems/ruby-2.7.6/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode: 14.3/14E222b - /usr/bin/xcodebuild
Languages:
Java: 11.0.18 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Enable New Architecture using RCT_NEW_ARCH_ENABLED=1 && pod install
and build from xcode version 14.3
Snack, code example, screenshot, or link to a repository
I have tried with arm64 active arch.
The text was updated successfully, but these errors were encountered: