mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
OSS: add Xcode 12.5 + M1 machines CocoaPods post_install workaround
Summary: Context: there are multiple issues currently exposed by Xcode 12.5 and/or M1 machine + Flipper. To unblock the new 0.66 release, let's add this workaround in the official react_native_pods.rb recipe and make RNTester and new app Podfile's call it directly. Changelog: [iOS][Fixed] Added workaround for Xcode 12.5 / M1 machines build issues Reviewed By: lunaleaps Differential Revision: D30691291 fbshipit-source-id: 8b24cc60da3d620dbc90f95c77f2345e18c28212
This commit is contained in:
committed by
Facebook GitHub Bot
parent
945c5f714d
commit
ac4ddec542
@@ -61,4 +61,5 @@ end
|
||||
|
||||
post_install do |installer|
|
||||
react_native_post_install(installer)
|
||||
__apply_Xcode_12_5_M1_post_install_workaround(installer)
|
||||
end
|
||||
|
||||
@@ -212,3 +212,38 @@ bash -l -c '$\{PODS_TARGET_SRCROOT\}/#{prefix}/scripts/generate-specs.sh #{codeg
|
||||
:show_env_vars_in_log => true
|
||||
}
|
||||
end
|
||||
|
||||
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines.
|
||||
# Call this in the app's main Podfile's post_install hook.
|
||||
# See https://github.com/facebook/react-native/issues/31480#issuecomment-902912841 for more context.
|
||||
# Actual fix was authored by https://github.com/mikehardy.
|
||||
# New app template will call this for now until the underlying issue is resolved.
|
||||
def __apply_Xcode_12_5_M1_post_install_workaround(installer)
|
||||
# Apple Silicon builds require a library path tweak for Swift library discovery to resolve Swift-related "symbol not found".
|
||||
# Note: this was fixed via https://github.com/facebook/react-native/commit/eb938863063f5535735af2be4e706f70647e5b90
|
||||
# Keeping this logic here but commented out for future reference.
|
||||
#
|
||||
# installer.aggregate_targets.each do |aggregate_target|
|
||||
# aggregate_target.user_project.native_targets.each do |target|
|
||||
# target.build_configurations.each do |config|
|
||||
# config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
|
||||
# end
|
||||
# end
|
||||
# aggregate_target.user_project.save
|
||||
# end
|
||||
|
||||
# Flipper podspecs are still targeting an older iOS deployment target, and may cause an error like:
|
||||
# "error: thread-local storage is not supported for the current target"
|
||||
# The most reliable known workaround is to bump iOS deployment target to match react-native (iOS 11 now).
|
||||
installer.pods_project.targets.each do |target|
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
|
||||
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 - set `__IPHONE_10_0` to our iOS target + 1.
|
||||
# See https://github.com/facebook/flipper/issues/834 for more details.
|
||||
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
|
||||
end
|
||||
|
||||
@@ -25,5 +25,6 @@ target 'HelloWorld' do
|
||||
|
||||
post_install do |installer|
|
||||
react_native_post_install(installer)
|
||||
__apply_Xcode_12_5_M1_post_install_workaround(installer)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user