react-native: Compilation error when hermes enabled: 'fmt/compile.h' file not found
Description
I’m trying to enable hermes on iOS, but when I set :hermes_enabled => true
in my Podfile I get the following compilation error:
In file included from /Users/guillermodefermin/taxfix/mobile-app-native-deps/ios/Pods/RCT-Folly/folly/Singleton.cpp:35:
/Users/guillermodefermin/taxfix/mobile-app-native-deps/ios/Pods/RCT-Folly/folly/portability/FmtCompile.h:19:10: fatal error:
'fmt/compile.h' file not found
#include <fmt/compile.h>
^~~~~~~~~~~~~~~
/Users/guillermodefermin/taxfix/mobile-app-native-deps/ios/Pods/RCT-Folly/folly/portability/FmtCompile.h:19:10: note:
did not find header 'compile.h' in framework 'fmt' (loaded from
'/Users/guillermodefermin/Library/Developer/Xcode/DerivedData/Taxfix/Build/Products/Debug-iphonesimulator/fmt')
1 error generated.
My setup:
- I’m using
use_frameworks! :linkage => :static
(one of the pods requires it) - I’m not using flipper
The same configuration works with no issues when :hermes_enabled => false
Version
0.66.1
Output of react-native info
info Fetching system and libraries information...
(node:95196) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: macOS 12.0
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Memory: 342.60 MB / 16.00 GB
Shell: 3.1.2 - /usr/local/bin/fish
Binaries:
Node: 14.15.5 - ~/.nvm/versions/node/v14.15.5/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.5/bin/yarn
npm: 6.14.11 - ~/.nvm/versions/node/v14.15.5/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /Users/guillermodefermin/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
Android SDK:
API Levels: 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 30.0.2, 31.0.0
System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 13.0/13A233 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_275 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: 0.66.1 => 0.66.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
- Enable hermes by setting:
:hermes_enabled => true
- Run
pod install
- Build with
react-native run-ios
or from xcode
Snack, code example, screenshot, or link to a repository
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 22
- Comments: 34 (9 by maintainers)
@wood1986 you could try this solution:
This should solve the RCT-Folly issue.
This solves the fmt.h file not found issue.
After adding above code to podfile, run pod install and rebuild your project, it’ll be compiled with success.
Same, not able to use RN:0.67.2 with hermes enabled. This RCT-Folly always had compile issues in past couple year. With below fix in Podfile you can solve this particular issue but then it’ll fail at somewhere else if
:hermes_enabled => true
. Build with using below will success without hermes.Just a heads up that 0.69.0 doesn’t containt this fix. We’ll be including it inside 69.1 potentially
This workaround totally worked for me
https://github.com/facebook/react-native/issues/32451#issuecomment-1028835616
⬇ In case you want to see entire Podfile (clic to unroll)
I don't have Flipper enabled, but `use_framework`.Here is mypodfile for
"react-native": "0.67.4"
yeah adding @andac-ozcan’s suggestion fixes the initial issue but then it fails on the next thing:
@Kudo 's fix on RN 0.69 seems to fix the issue, thanks Kudo 👍
If anyone needs to apply this fix to the older versions of RN, adding this to the Podfile does the trick (based on Kudo’s fix on https://github.com/facebook/react-native/pull/34030):
If use_frameworks! is used in the Podfile. This configuration will cause bitcode to be unavailable.
@passerbyloo
hello guys, I solved this by setting all react native libraries to static library in podfile. NOTICE: all means whether it is a swift library or a oc library, if it depends React or React Core, it should be static compiled.
This works with RN 0.67.2