Skip to content

Commit

Permalink
ios build: Fix Xcode 15 build issue by taking RN Ruby script patch
Browse files Browse the repository at this point in the history
RN merged this fix in main in facebook/react-native@10d55888c, but I
made this patch from their v0.69 cherry-pick to get a smaller diff;
that's facebook/react-native@37e8df1cd.
  • Loading branch information
chrisbobbe committed Sep 21, 2023
1 parent 73ff2c6 commit 3e84405
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions patches/react-native+0.68.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index f2ceeda..c618f77 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -254,6 +254,7 @@ def react_native_post_install(installer)
cpp_flags = NEW_ARCH_OTHER_CPLUSPLUSFLAGS
end
modify_flags_for_new_architecture(installer, cpp_flags)
+ apply_xcode_15_patch(installer)

end

@@ -661,3 +662,16 @@ def __apply_Xcode_12_5_M1_post_install_workaround(installer)
time_header = "#{Pod::Config.instance.installation_root.to_s}/Pods/RCT-Folly/folly/portability/Time.h"
`sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' #{time_header}`
end
+
+# Fix to build react native on Xcode 15 beta 1
+def apply_xcode_15_patch(installer)
+ installer.target_installation_results.pod_target_installation_results
+ .each do |pod_name, target_installation_result|
+ target_installation_result.native_target.build_configurations.each do |config|
+ # unary_function and binary_function are no longer provided in C++17 and newer standard modes as part of Xcode 15. They can be re-enabled with setting _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
+ # Ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited) '
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '"_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION" '
+ end
+ end
+end

0 comments on commit 3e84405

Please sign in to comment.