Skip to content

Commit

Permalink
Fix RCT-Folly build error when use_frameworks! and hermes are both en…
Browse files Browse the repository at this point in the history
…abled (#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: #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 #34011 and this prs' patch
$ pod install
$ yarn ios
```

Reviewed By: cortinico

Differential Revision: D37284084

Pulled By: dmitryrykun

fbshipit-source-id: 923fa03d7844d1d227880919c8b2c8614c848d59
  • Loading branch information
Kudo authored and facebook-github-bot committed Jun 21, 2022
1 parent e5c5dcd commit 79baca6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion third-party-podspecs/RCT-Folly.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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\"" }
Expand Down

0 comments on commit 79baca6

Please sign in to comment.