Skip to content
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

React-RCTFabric compile issue #482

Closed
LevRozhkov opened this issue Mar 19, 2024 · 3 comments
Closed

React-RCTFabric compile issue #482

LevRozhkov opened this issue Mar 19, 2024 · 3 comments

Comments

@LevRozhkov
Copy link

Description

I added React Native 0.73.6 to the project, adjusted podfile, did Codegen and project compiled successfully. But after I added some other dependencies to the package.json file and did same steps - project failed to compile. From what I understood, it is related to react-native-safe-area-context and react-native-screens dependencies. I use latest versions of all dependencies.

I tried to create a new RN project but on clear project I have the same compile issue.

React-RCTFabric compile issue
ld: Undefined symbols: _RNCSafeAreaProviderCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNCSafeAreaViewCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNCViewPagerCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNGestureHandlerButtonCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNGestureHandlerRootViewCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSFullWindowOverlayCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSScreenCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSScreenContainerCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSScreenNavigationContainerCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSScreenStackCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSScreenStackHeaderConfigCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSScreenStackHeaderSubviewCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o _RNSSearchBarCls, referenced from: _RCTThirdPartyFabricComponentsProvider in RCTThirdPartyFabricComponentsProvider.o clang: error: linker command failed with exit code 1 (use -v to see invocation)

My package.json dependencies:

"dependencies": { "@babel/core": "^7.24.0", "@babel/preset-env": "^7.24.0", "@react-native/metro-config": "^0.75.0-main", "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/core": "^6.4.16", "@react-navigation/drawer": "^6.6.15", "@react-navigation/elements": "^1.3.30", "@react-navigation/material-bottom-tabs": "^6.2.28", "@react-navigation/material-top-tabs": "^6.6.13", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@react-navigation/routers": "^6.1.9", "@react-navigation/stack": "^6.3.29", "@types/react": "^18.2.67", "react": "^18.2.0", "react-native": "^0.73.6", "react-native-gesture-handler": "^2.15.0", "react-native-pager-view": "^6.2.3", "react-native-paper": "^5.12.3", "react-native-reanimated": "^3.8.1", "react-native-safe-area-context": "^4.9.0", "react-native-screens": "^3.29.0", "react-native-tab-view": "^3.5.2", "react-native-vector-icons": "^10.0.3", "typescript": "^5.4.2" }

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!

use_frameworks!

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

def __apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end

sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h
end

def pods
#my pods
end

config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

target 'MyApp' do
pods
end
pre_install do |installer|
installer.pod_targets.each do |pod|
if ['RNScreens', 'RNReanimated'].include? pod.name
def pod.build_type
Pod::BuildType.static_library
end
end
end
end

post_install do |installer|
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
__apply_Xcode_14_3_RC_post_install_workaround(installer)
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
`

I tried to add everything as static libraries(use_framework with static linkage) but this didn't help

Output of npx react-native info

System:
  OS: macOS 14.2.1
  CPU: (10) x64 Apple M1 Pro
  Memory: 29.82 MB / 16.00 GB
  Shell:
    version: 3.2.57
    path: /bin/bash
Binaries:
  Node:
    version: 20.11.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.21
    path: /usr/local/bin/yarn
  npm:
    version: 10.5.0
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  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.73.6
    wanted: ^0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: false
image

Steps to reproduce

  1. Install packages via yarn install
  2. cd iod && pod install
  3. cd .. && node node_modules/react-native/scripts/generate-codegen-artifacts.js --path ./ --outputPath iOS/
  4. open Xcode project and try to compile

Snack or a link to a repository

https://github.com/LevRozhkov/react-fabric-issue-repro

react-native-safe-area-context version

4.9.0

React Native version

0.73.6

Platforms

iOS

@jacobp100
Copy link
Collaborator

Are you on the new arch?

#473

@LevRozhkov
Copy link
Author

Are you on the new arch?

#473

No, as I mentioned in description, newArchEnabled: false

@jacobp100
Copy link
Collaborator

It wasn't the easiest thing to read 🤣

Make sure you only have one copy of all your RN libraries - e.g. run yarn why react-native-safe-area-context and check only one entry shows up

In Xcode, click 'Project' and 'Clean Build Folder', then try again

I'll close this issue because there isn't a library issue - but hope this helps anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants