-
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
Regression -- 0.72 fails to compile on iOS with use_frameworks! :linkage => :static when using pnpm #38140
Comments
We have tests in CI that checks that the static frameworks builds (e.g.: Old Arch, Static Frameworks and Old Arch, dynamic frameworks) These create a new app from the templates and install the pods accordingly, so that shouldn't happen. Also, this error:
Doesn't really told us anything: it only says that it failed to build Could you provide the whole build log, uploading it somewhere? |
@cipolleschi apologies! I copy pasted the wrong snippet 🤦 The failure in
Here's a full build log: https://gist.github.com/evelant/2e1479de86cde27e287f07974c9b8d53 |
IIRC there was an issue with header paths that was pnpm specific in previous versions but it got fixed. Here it is: #34102 |
Here's the reproduction without using pnpm, same failure https://github.com/evelant/rn072-ios-frameworks-static-failure |
can you try running |
This is a pnpm issue -- failure is the same with NO_FLIPPER=1 on the pnpm reproduction. Most likely a resurfacing of #34102 due to how headers at symlinked paths in the pnpm store get copied |
@cipolleschi I found and fixed the issue, although I'm not sure if my solution is ideal. The problem is that cocoapods doesn't resolve the symlink when To fix this I altered the podspecs to resolve the absolute paths for Here's a patch |
@evelant how to apply above patch ? when tried with patch-package it says invalid patch file |
@Janak-Nirmal I think the patch file is just missing a newline at the end. Add one and it should apply. |
Hi @evelant! I had a look at the patch and most of the changes looks good, actually. Would you mind to create a PR against the React Native |
@cipolleschi done #38158 |
So, I'm encountering the same error on 0.72.1 and 0.73 nightly, and I've never used pnpm. Using yarn here. Cleared node_modules, Podfile.lock and Pods/ dir and XCode DerivedData between versions with no luck. Tried the patch as well on 0.72 and 0.73 with no luck. Podfile:
And my build log, error on line 11228:
|
Alright, I figured it out. If anyone else has this issue, notice the
This is a workaround for static frameworks that used to be mentioned by the react-native-permissions package, but it looks like it's no longer required. After removing this as well as the individual permissions pods and updating the iOS permissions used in my package.json file as per the react-native-permissions README, we are back in business! New Podfile:
|
Nope no patch needed, worked as expected once I changed my Podfile and added iOS permissions to |
Applying the patch 58adc5e fixed it for me (using yarn) |
Summary: Fix build failure on iOS with pnpm and use_frameworks! due to cocoapods copying symlinked headers to wrong paths When using pnpm all packages are symlinked to node_modules/.pnpm to prevent phantom dependency resolution. This causes react-native iOS build to fail because Cocoapods copies headers to incorrect destinations when they're behind symlinks. The fix resolves absolute paths to the header_mappings_dir at pod install time. With absolute paths cocoapods copies the headers correctly. This commit also adds a few missing header search paths in use_frameworks! mode. Fixes #38140 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [IOS] [FIXED] - Build failure with pnpm and use_frameworks! due to incorrect header paths For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #38158 Test Plan: 1. `pnpm pnpx react-native@latest init AwesomeProject` 2. `cd AwesomeProject` 3. `rm -rf node_modules yarn.lock` 4. `mkdir patches` 5. copy [react-native@0.72.1.patch](https://github.com/facebook/react-native/files/11937570/react-native%400.72.1.patch) to `patches/` 6. Add patch to package.json ``` "pnpm": { "patchedDependencies": { "react-native@0.72.1": "patches/react-native@0.72.1.patch" } } ``` 7. `pnpm install` 8. `cd ios` 9. `NO_FLIPPER=1 USE_FRAMEWORKS=static pod install` 10. `cd ..` 11. `pnpm react-native run-ios` Hopefully an automated test of building with `pnpm` can be added to CI. I don't know how to make that happen, hopefully someone at facebook can do it. Reviewed By: dmytrorykun Differential Revision: D47211946 Pulled By: cipolleschi fbshipit-source-id: 87640bd3f32f023c43291213b5291a7b990d7e1f
I get the error: 'react/debug/react_native_assert.h' file not found, React-utils/RunLoopObserver.
|
Summary: Fix build failure on iOS with pnpm and use_frameworks! due to cocoapods copying symlinked headers to wrong paths When using pnpm all packages are symlinked to node_modules/.pnpm to prevent phantom dependency resolution. This causes react-native iOS build to fail because Cocoapods copies headers to incorrect destinations when they're behind symlinks. The fix resolves absolute paths to the header_mappings_dir at pod install time. With absolute paths cocoapods copies the headers correctly. This commit also adds a few missing header search paths in use_frameworks! mode. Fixes facebook#38140 ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [IOS] [FIXED] - Build failure with pnpm and use_frameworks! due to incorrect header paths For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: facebook#38158 Test Plan: 1. `pnpm pnpx react-native@latest init AwesomeProject` 2. `cd AwesomeProject` 3. `rm -rf node_modules yarn.lock` 4. `mkdir patches` 5. copy [react-native@0.72.1.patch](https://github.com/facebook/react-native/files/11937570/react-native%400.72.1.patch) to `patches/` 6. Add patch to package.json ``` "pnpm": { "patchedDependencies": { "react-native@0.72.1": "patches/react-native@0.72.1.patch" } } ``` 7. `pnpm install` 8. `cd ios` 9. `NO_FLIPPER=1 USE_FRAMEWORKS=static pod install` 10. `cd ..` 11. `pnpm react-native run-ios` Hopefully an automated test of building with `pnpm` can be added to CI. I don't know how to make that happen, hopefully someone at facebook can do it. Reviewed By: dmytrorykun Differential Revision: D47211946 Pulled By: cipolleschi fbshipit-source-id: 87640bd3f32f023c43291213b5291a7b990d7e1f
You're using react-native-permissions the old way like I was. Try the fix I posted above^ |
@maksibajo4 Did you fix the build issue you faced? I am also facing the same issue as I also have some dynamic frameworks (iProov) to be exempted from being converted to static library. |
@goguda the issue is basically due to this part and updating the integration of RN permissions doesn't help.
|
@goguda i am getting this error, i am using npm this is my podfile # # 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
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
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__]).strip
end
platform :ios, '13.4'
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')
prepare_react_native_project!
setup_permissions([
'LocationAccuracy',
'LocationAlways',
'LocationWhenInUse',
])
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
# 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 'vendit' do
config = use_native_modules!
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps', '7.4.0' # <<<<---- I added the '5.1.0' version here
pod 'Google-Maps-iOS-Utils', '4.2.2'
# Flags change depending on the env values.
flags = get_default_flags()
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
: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}/.."
)
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# installer.pods_project.targets.each do |target|
# if target.name == "React-Core-AccessibilityResources"
# target.remove_from_project
# end
# end
# end
target 'venditTests' do
inherit! :complete
# Pods for testing
end
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
end and package.json file {
"name": "vendit",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"android-clean": "cd android && gradlew clean && gradlew :app:bundleRelease",
"build-apk": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/ && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && cd android && ./gradlew assembleRelease && cd ..",
"build-debug-apk": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/debug/ && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && cd android && gradlew assembleDebug && cd ..",
"iLegacy": "npm i --legacy-peer-deps"
},
"dependencies": {
"@gorhom/bottom-sheet": "^4.5.1",
"@notifee/react-native": "^7.8.2",
"@react-native-async-storage/async-storage": "^1.19.3",
"@react-native-community/blur": "^4.3.2",
"@react-native-community/cli-platform-android": "^11.3.8",
"@react-native-community/datetimepicker": "^7.6.0",
"@react-native-community/netinfo": "^9.4.1",
"@react-native-firebase/app": "^18.9.0",
"@react-native-firebase/dynamic-links": "^18.9.0",
"@react-native-firebase/messaging": "^18.9.0",
"@react-native-masked-view/masked-view": "^0.2.9",
"@react-navigation/bottom-tabs": "^6.5.9",
"@react-navigation/elements": "^1.3.19",
"@react-navigation/material-top-tabs": "^6.6.12",
"@react-navigation/native": "^6.1.8",
"@react-navigation/native-stack": "^6.9.14",
"@reduxjs/toolkit": "^1.9.6",
"axios": "^1.5.1",
"base64-js": "^1.5.1",
"deprecated-react-native-prop-types": "^5.0.0",
"i18next": "^23.5.1",
"lottie-ios": "^4.4.0",
"lottie-react-native": "^6.6.0",
"patch-package": "^8.0.0",
"react": "18.2.0",
"react-i18next": "^13.2.2",
"react-native": "0.72.5",
"react-native-asset": "^2.1.1",
"react-native-camera": "^4.2.1",
"react-native-country-picker-modal": "^2.0.0",
"react-native-geolocation-service": "^5.3.1",
"react-native-gesture-handler": "^2.13.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.8.3",
"react-native-maps": "^1.7.1",
"react-native-modal": "^13.0.1",
"react-native-modal-popover": "^2.1.3",
"react-native-navigation-bar-color": "^2.0.2",
"react-native-pager-view": "^6.2.1",
"react-native-permissions": "^3.10.1",
"react-native-popup-menu": "^0.16.1",
"react-native-qrcode-scanner": "^1.5.5",
"react-native-qrcode-svg": "^6.3.0",
"react-native-reanimated": "^3.7.2",
"react-native-safe-area-context": "^4.7.2",
"react-native-screens": "^3.25.0",
"react-native-share": "^10.0.2",
"react-native-shimmer-placeholder": "^2.0.9",
"react-native-splash-screen": "^3.3.0",
"react-native-svg": "^13.14.0",
"react-native-svg-transformer": "^1.1.0",
"react-native-tab-view": "^3.5.2",
"react-native-toast-message": "^2.1.6",
"react-native-vector-icons": "^10.0.1",
"react-native-webview": "^13.7.0",
"react-native-wheel-pick": "^1.2.2",
"react-redux": "^8.1.2",
"redux": "^4.2.1",
"rn-fetch-blob": "^0.12.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.11",
"babel-jest": "^29.2.1",
"babel-plugin-module-resolver": "^5.0.0",
"eslint": "^8.19.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.8",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0"
},
"engines": {
"node": ">=16"
},
"resolutions": {
"react-native-permissions": "^3.8.0"
},
"overrides": {
"react-native-qrcode-scanner": {
"react-native-permissions": "^3.8.0"
}
}
} Started getting this error after firebase messaging setup |
For me, I was placing this line of code: above It was supposed to be inside. |
I facing this issue, the error occurs when using Solution 1: Switch to Solution 2: Avoid
I also noticed a pull request addressing this issue—hopefully, it will be merged soon, and we won't need to apply this manual fix anymore. Here is my environment for reference:
I use monorepo with pnpm:
My Podfile:
|
Adding: instead of |
Thanks @DaniloMladenovic 🙏🏻 [
'expo-build-properties',
{
ios: {
// Firebase fix
extraPods: ['GoogleUtilities', 'FirebaseCore'].map((podName) => ({
name: podName,
modular_headers: true,
})),
},
},
] |
New Version
0.72.1
Old Version
0.71.11
Build Target(s)
iOS development
Output of
react-native info
Issue and Reproduction Steps
Reproduction: https://github.com/evelant/rn072-pnpm-monorepo-ios-frameworks-static-bug
React-native 0.72 fails to compile for iOS when using
use_frameworks! :linkage => :static
To reproduce:
pnpm install
cd apps/testproj/ios
USE_FRAMEWORKS=static pod install
cd ..
pnpm react-native run-ios
The text was updated successfully, but these errors were encountered: