From 7459c3d23d22dfa66d23e294bc4c023b2b0ad5cc Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Mon, 20 Jun 2022 17:23:23 -0700 Subject: [PATCH] Fix RCT-Folly build error when use_frameworks! and hermes are both enabled (#34030) Summary: This PR is fixing the build errors on iOS when `use_frameworks!` and `:hermes_enabled` are both enabled. There are two errors: - fmt/compile.h include not found: This PR adds fmt in header search paths. - undefined symbols `_jump_fcontext` and `_make_fcontext` from boost. the two symbols are actually not be unused. because to generate the shared library in dynamic framework mode, LTO (Link-Time-Optimization) is not as powerful as generating a single executable. ## Changelog [iOS] [Fixed] - Fix RCT-Folly build error when use_frameworks! and hermes are both enabled Pull Request resolved: https://github.com/facebook/react-native/pull/34030 Test Plan: - CI passed - ``` $ npx react-native init RN069 --version next # edit RN069/ios/Podfile to enable use_frameworks! and hermes_enabled # patch node_modules/react-native from both https://github.com/facebook/react-native/issues/34011 and this prs' patch $ pod install $ yarn ios ``` Reviewed By: cortinico Differential Revision: D37284084 Pulled By: dmitryrykun fbshipit-source-id: 923fa03d7844d1d227880919c8b2c8614c848d59 (cherry picked from commit 79baca678a743560fa16fdd551f1d0d018d34304) --- third-party-podspecs/RCT-Folly.podspec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/third-party-podspecs/RCT-Folly.podspec b/third-party-podspecs/RCT-Folly.podspec index 700cd7e2cfb48d..9c2e19d1b51ca5 100644 --- a/third-party-podspecs/RCT-Folly.podspec +++ b/third-party-podspecs/RCT-Folly.podspec @@ -75,7 +75,10 @@ Pod::Spec.new do |spec| spec.libraries = "c++abi" # NOTE Apple-only: Keep c++abi here due to https://github.com/react-native-community/releases/issues/251 spec.pod_target_xcconfig = { "USE_HEADERMAP" => "NO", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include/\"" } + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include/\" \"$(PODS_ROOT)/fmt/include\"", + # In dynamic framework (use_frameworks!) mode, ignore the unused and undefined boost symbols when generating the library. + "OTHER_LDFLAGS" => "\"-Wl,-U,_jump_fcontext\" \"-Wl,-U,_make_fcontext\"" + } # TODO: The boost spec should really be selecting these files so that dependents of Folly can also access the required headers. spec.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"" }