From eede05c91b6022b3b763a44b395c9e8bf96b0a2e Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Mon, 25 Oct 2021 11:32:27 -0700 Subject: [PATCH] Add back Xcode_12_5_M1_post_install_workaround Summary: Changelog: [Internal] Add back Xcode_12_5_M1_post_install_workaround workaround Reviewed By: sota000 Differential Revision: D31902449 fbshipit-source-id: 5c9d962d0d1a55a9f14186bd7d6d8fe087101f0d --- packages/rn-tester/Podfile | 1 + scripts/react_native_pods.rb | 17 ++++++++++++++--- template/ios/Podfile | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index 88d94344f2f..a6902753aea 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -52,4 +52,5 @@ end post_install do |installer| react_native_post_install(installer) + __apply_Xcode_12_5_M1_post_install_workaround(installer) end diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 3c6a21eacc8..2b697ac50be 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -374,8 +374,19 @@ end # 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. -# -# It's not needed anymore and will be removed later def __apply_Xcode_12_5_M1_post_install_workaround(installer) - puts "__apply_Xcode_12_5_M1_post_install_workaround() is not needed anymore" + # 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 diff --git a/template/ios/Podfile b/template/ios/Podfile index 65d5ffcbfcf..9409747f917 100644 --- a/template/ios/Podfile +++ b/template/ios/Podfile @@ -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