Closed evelant closed 1 year ago
We have tests in CI that checks that the static frameworks builds (e.g.: Old Arch, Static Frameworks and Old Arch, dynamic frameworks) and they work on the new arch as well (e.g.: Hermes, JSC)
These create a new app from the templates and install the pods accordingly, so that shouldn't happen.
Could it be a problem of pnpm
? That's a setup we are actually not testing.
Also, this error:
The following build commands failed:
CompileC /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-aijjqxpffhriwvdbnbtslrapnlmx/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/Objects-normal/arm64/RunLoopObserver.o /Users/imagio/dev/test/node_modules/.pnpm/react-native@0.72.1_@babel+core@7.20.2_@babel+preset-env@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-utils' from project 'Pods')
(1 failure)
Doesn't really told us anything: it only says that it failed to build RunLoopObserver.cpp
but not why... :/
Could you provide the whole build log, uploading it somewhere?
@cipolleschi apologies! I copy pasted the wrong snippet 🤦
The failure in RunLoopObserver.cpp
is 'react/debug/react_native_assert.h' file not found
.
CompileC /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/Objects-normal/arm64/RunLoopObserver.o /Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/node_modules/.pnpm/react-native@0.72.1_@babel+core@7.20.2_@babel+preset-env@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-utils' from project 'Pods')
cd /Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/ios/Pods
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -ivfsstatcache /Users/imagio/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator16.4-20E238-.sdkstatcache -target arm64-apple-ios12.4-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=c++17 -stdlib\=libc++ -fmodules -gmodules -fmodules-cache-path\=/Users/imagio/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/imagio/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -fmodule-name\=React_utils -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Index.noindex/DataStore -iquote /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/React_utils-generated-files.hmap -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/React_utils-own-target-headers.hmap -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/React_utils-all-non-framework-target-headers.hmap -ivfsoverlay /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/all-product-headers.yaml -iquote /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/React_utils-project-headers.hmap -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/React-utils/include -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/React-NativeModulesApple/React_NativeModulesApple.framework/Headers -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios -I/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/ios/Pods/RCT-Folly -I/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/node_modules/react-native/ReactCommon/react/utils -I/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/node_modules/react-native/ReactCommon/react/utils/ReactCommon -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/React-debug/React_debug.framework/Headers -I/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/ios/Pods/RCT-Folly -I/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/ios/Pods/DoubleConversion -I/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/ios/Pods/boost -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/DerivedSources-normal/arm64 -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/DerivedSources/arm64 -I/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/DerivedSources -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/React-utils -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/DoubleConversion -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/RCT-Folly -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/React-debug -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/fmt -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/glog -F/Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Products/Debug-iphonesimulator/libevent -DFOLLY_NO_CONFIG -DFOLLY_MOBILE\=1 -DFOLLY_USE_LIBCPP\=1 -Wno-comma -Wno-shorten-64-to-32 -include /Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/apps/testproj/ios/Pods/Target\ Support\ Files/React-utils/React-utils-prefix.pch -MMD -MT dependencies -MF /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/Objects-normal/arm64/RunLoopObserver.d --serialize-diagnostics /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/Objects-normal/arm64/RunLoopObserver.dia -c /Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/node_modules/.pnpm/react-native@0.72.1_@babel+core@7.20.2_@babel+preset-env@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp -o /Users/imagio/Library/Developer/Xcode/DerivedData/testproj-apwspzmyimbgmwevshwwgfiakwkt/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-utils.build/Objects-normal/arm64/RunLoopObserver.o -index-unit-output-path /Pods.build/Debug-iphonesimulator/React-utils.build/Objects-normal/arm64/RunLoopObserver.o
/Users/imagio/dev/rn072-pnpm-monorepo-ios-frameworks-static-bug/node_modules/.pnpm/react-native@0.72.1_@babel+core@7.20.2_@babel+preset-env@7.20.2_react@18.2.0/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp:10:10: fatal error: 'react/debug/react_native_assert.h' file not found
#include <react/debug/react_native_assert.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
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: https://github.com/facebook/react-native/issues/34102
Here's the reproduction without using pnpm, same failure
https://github.com/evelant/rn072-ios-frameworks-static-failure
can you try running USE_FRAMEWORKS=static NO_FLIPPER=1 pod install
?
Flipper is not compatible with use_frameworks
(and it will never be).
This is a pnpm issue -- failure is the same with NO_FLIPPER=1 on the pnpm reproduction. Most likely a resurfacing of https://github.com/facebook/react-native/issues/34102 due to how headers at symlinked paths in the pnpm store get copied
This is indeed the same issue as before. I don't remember how it got resolved unfortunately. The problem is that the headers get copied into the wrong directory:
@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 header_mappings_dir
is set in the podspec. That causes headers to get copied as a relative path to the inside of the pnpm store instead of to their actual output directory. You end up with headers in Build/node_modules/.pnpm/react-native/node_modules/react-native/ReactCommon/react/...etc
instead of in the framework dirs.
To fix this I altered the podspecs to resolve the absolute paths for header_mappings_dir
. I also fixed a number of search paths that didn't work correctly (I think they may have always been incorrect but worked by luck with yarn).
Here's a patch react-native@0.72.1.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 main
branch so we can make sure we don't break such use case in the future and we can discuss the specific changes?
@cipolleschi done https://github.com/facebook/react-native/pull/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:
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
$RNFirebaseAnalyticsWithoutAdIdSupport = true
$RNGoogleMobileAdsAsStaticFramework = true
platform :ios, min_ios_version_supported
prepare_react_native_project!
target 'roomi_app' do
permissions_path = '../node_modules/react-native-permissions/ios'
rn_maps_path = '../node_modules/react-native-maps'
config = use_native_modules!
flags = get_default_flags()
use_frameworks! :linkage => :static
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'react-native-maps', path: rn_maps_path
pod 'GoogleMaps'
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'FirebaseInstallations', :modular_headers => true
pod 'GoogleDataTransport', :modular_headers => true
pod 'nanopb', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'react-native-google-maps', path: rn_maps_path
pod 'react-native-branch', path: '../node_modules/react-native-branch'
pod 'FirebaseAnalytics/WithoutAdIdSupport'
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.disabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'roomi_appTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()
def configure_branch_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'BRANCH_EXCLUDE_IDFA_CODE=1']
end
end
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
post_install do |installer|
react_native_post_install(installer,
config[:reactNativePath],
:mac_catalyst_enabled => false)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
if target.name == 'Branch'
configure_branch_settings(target)
end
end
installer.pods_project.targets.each do |target|
if target.name == 'RCT-Folly'
target.build_configurations.each do |config|
config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
end
end
end
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
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
target.build_configurations.each do |config|
if config.name != "Release"
config.build_settings['DEVELOPMENT_TEAM'] = "XXXXXXXXXX"
else
config.build_settings['DEVELOPMENT_TEAM'] = "XXXXXXXXXX"
end
end
end
end
end
And my build log, error on line 11228:
/Users/david/Documents/iroomit/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp:10:10: fatal error: 'react/debug/react_native_assert.h' file not found
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:
require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', __dir__]).strip $RNFirebaseAnalyticsWithoutAdIdSupport = true $RNGoogleMobileAdsAsStaticFramework = true platform :ios, min_ios_version_supported prepare_react_native_project! target 'roomi_app' do permissions_path = '../node_modules/react-native-permissions/ios' rn_maps_path = '../node_modules/react-native-maps' config = use_native_modules! flags = get_default_flags() use_frameworks! :linkage => :static pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary" pod 'Permission-Camera', :path => "#{permissions_path}/Camera" pod 'react-native-maps', path: rn_maps_path pod 'GoogleMaps' pod 'FirebaseCoreExtension', :modular_headers => true pod 'FirebaseInstallations', :modular_headers => true pod 'GoogleDataTransport', :modular_headers => true pod 'nanopb', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'react-native-google-maps', path: rn_maps_path pod 'react-native-branch', path: '../node_modules/react-native-branch' pod 'FirebaseAnalytics/WithoutAdIdSupport' use_react_native!( :path => config[:reactNativePath], :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], :flipper_configuration => FlipperConfiguration.disabled, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'roomi_appTests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. # use_flipper!() def configure_branch_settings(target) target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'BRANCH_EXCLUDE_IDFA_CODE=1'] end end pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} installer.pod_targets.each do |pod| def pod.build_type; # Uncomment the line corresponding to your CocoaPods version Pod::BuildType.static_library # >= 1.9 # Pod::Target::BuildType.static_library # < 1.9 end end end post_install do |installer| react_native_post_install(installer, config[:reactNativePath], :mac_catalyst_enabled => false) __apply_Xcode_12_5_M1_post_install_workaround(installer) installer.pods_project.targets.each do |target| if target.name == 'Branch' configure_branch_settings(target) end end installer.pods_project.targets.each do |target| if target.name == 'RCT-Folly' target.build_configurations.each do |config| config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include" end end end 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 if target.name == 'react-native-google-maps' target.build_configurations.each do |config| config.build_settings['CLANG_ENABLE_MODULES'] = 'No' end end target.build_configurations.each do |config| if config.name != "Release" config.build_settings['DEVELOPMENT_TEAM'] = "XXXXXXXXXX" else config.build_settings['DEVELOPMENT_TEAM'] = "XXXXXXXXXX" end end end end end
And my build log, error on line 11228:
/Users/david/Documents/iroomit/node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp:10:10: fatal error: 'react/debug/react_native_assert.h' file not found
Alright, I figured it out. If anyone else has this issue, notice the pre_install
directive in my Podfile:
pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
def pod.build_type;
# Uncomment the line corresponding to your CocoaPods version
Pod::BuildType.static_library # >= 1.9
# Pod::Target::BuildType.static_library # < 1.9
end
end
end
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:
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
$RNFirebaseAnalyticsWithoutAdIdSupport = true
$RNGoogleMobileAdsAsStaticFramework = true
platform :ios, min_ios_version_supported
prepare_react_native_project!
target 'roomi_app' do
permissions_path = '../node_modules/react-native-permissions/ios'
rn_maps_path = '../node_modules/react-native-maps'
config = use_native_modules!
flags = get_default_flags()
use_frameworks! :linkage => :static
pod 'react-native-maps', path: rn_maps_path
pod 'GoogleMaps'
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'FirebaseInstallations', :modular_headers => true
pod 'GoogleDataTransport', :modular_headers => true
pod 'nanopb', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'react-native-google-maps', path: rn_maps_path
pod 'react-native-branch', path: '../node_modules/react-native-branch'
pod 'FirebaseAnalytics/WithoutAdIdSupport'
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.disabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'roomi_appTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()
def configure_branch_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'BRANCH_EXCLUDE_IDFA_CODE=1']
end
end
post_install do |installer|
react_native_post_install(installer,
config[:reactNativePath],
:mac_catalyst_enabled => false)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
if target.name == 'Branch'
configure_branch_settings(target)
end
end
installer.pods_project.targets.each do |target|
if target.name == 'RCT-Folly'
target.build_configurations.each do |config|
config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
end
end
end
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
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
target.build_configurations.each do |config|
if config.name != "Release"
config.build_settings['DEVELOPMENT_TEAM'] = "XXXXXXXXXX"
else
config.build_settings['DEVELOPMENT_TEAM'] = "XXXXXXXXXX"
end
end
end
end
end
@goguda I am also facing the same issue 'react/debug/react_native_assert.h' file not found
. I am using yarn as well. So after upgrading react-native-permissions
, did you still use the react-native patch file @evelant mentioned?
@goguda I am also facing the same issue
'react/debug/react_native_assert.h' file not found
. I am using yarn as well. So after upgradingreact-native-permissions
, did you still use the react-native patch file @evelant mentioned?
Nope no patch needed, worked as expected once I changed my Podfile and added iOS permissions to reactNativePermissionsIOS
in my package.json as per the documentation.
Applying the patch https://github.com/facebook/react-native/commit/58adc5e4b9ab74b67b4af04d1e72c387af848ea7 fixed it for me (using yarn)
I get the error: 'react/debug/react_native_assert.h' file not found, React-utils/RunLoopObserver. 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
platform :ios, '13.0'
prepare_react_native_project!
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
dynamic_frameworks = [
'Starscream',
'iProov',
'DatadogSDK',
'SwiftProtobuf',
]
pre_install do |installer|
installer.pod_targets.each do |pod|
if !dynamic_frameworks.include?(pod.name)
puts "Overriding the static_framework? method for #{pod.name}"
def pod.static_framework?;
true
end
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end
target 'POK' do
use_frameworks! :linkage => :static
config = use_native_modules!
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => true,
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.disabled,
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts"
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'
pod 'SRSRadialGradient', :path => '../node_modules/react-native-radial-gradient/ios'
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'FirebaseInstallations', :modular_headers => true
pod 'GoogleDataTransport', :modular_headers => true
pod 'nanopb', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
$RNFirebaseAsStaticFramework = true
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
target 'POKTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_13_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
path = "Pods/Target Support Files/Pods-POK/Pods-POK-frameworks.sh"
lines = File.readlines(path)
lines.insert(177, 'install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
File.write(path, lines.join, mode: "w")
end
end
I have a PR for adding 2 more to the search path can you take a look? @evelant
I get the error: 'react/debug/react_native_assert.h' file not found, React-utils/RunLoopObserver. 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 platform :ios, '13.0' prepare_react_native_project! flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled dynamic_frameworks = [ 'Starscream', 'iProov', 'DatadogSDK', 'SwiftProtobuf', ] pre_install do |installer| installer.pod_targets.each do |pod| if !dynamic_frameworks.include?(pod.name) puts "Overriding the static_framework? method for #{pod.name}" def pod.static_framework?; true end def pod.build_type; Pod::BuildType.static_library end end end end target 'POK' do use_frameworks! :linkage => :static config = use_native_modules! flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], :hermes_enabled => true, :fabric_enabled => flags[:fabric_enabled], :flipper_configuration => FlipperConfiguration.disabled, :app_path => "#{Pod::Config.instance.installation_root}/.." ) permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-Camera', :path => "#{permissions_path}/Camera" pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts" pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications" pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon' pod 'SRSRadialGradient', :path => '../node_modules/react-native-radial-gradient/ios' pod 'FirebaseCoreExtension', :modular_headers => true pod 'FirebaseInstallations', :modular_headers => true pod 'GoogleDataTransport', :modular_headers => true pod 'nanopb', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true $RNFirebaseAsStaticFramework = true rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path target 'POKTests' do inherit! :complete # Pods for testing end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end end installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' end end end `sed -i -e $'s/__IPHONE_10_0/__IPHONE_13_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h` path = "Pods/Target Support Files/Pods-POK/Pods-POK-frameworks.sh" lines = File.readlines(path) lines.insert(177, 'install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n") File.write(path, lines.join, mode: "w") end end
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.
def pod.static_framework?;
true
end
def pod.build_type;
Pod::BuildType.static_library
end
@goguda i am getting this error, i am using npm node_modules/react-native/ReactCommon/react/utils/RunLoopObserver.cpp:10:10: 'react/debug/react_native_assert.h' file not found
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:
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
above
target 'commutebuddy' do
config = use_native_modules!
It was supposed to be inside.
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