question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compilation error when hermes enabled: 'fmt/compile.h' file not found

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:22
  • Comments:32 (8 by maintainers)

github_iconTop GitHub Comments

10reactions
razor1895commented, Jun 10, 2022

@wood1986 you could try this solution:

This should solve the RCT-Folly issue.

use_frameworks! :linkage => :static

This solves the fmt.h file not found issue.

    # https://github.com/facebook/react-native/issues/32451
    installer.pods_project.targets.each do |target|
      if target.name == 'RCT-Folly'
        target.build_configurations.each do |config|
          config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
        end
      end
    end

After adding above code to podfile, run pod install and rebuild your project, it’ll be compiled with success.

6reactions
cortinicocommented, Jun 22, 2022

@Kudo 's fix on RN 0.69 seems to fix the issue, thanks Kudo 👍

Just a heads up that 0.69.0 doesn’t containt this fix. We’ll be including it inside 69.1 potentially

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native: RCT-Folly fatal error - 'fmt/compile.h' file not found
Just set header search paths to fmt sources directly for RCT-Folly target in post_install to resolve this issue: Podfile:
Read more >
Bundled Hermes - React Native
This page gives an overview of how Hermes and React Native are built. If you're looking into instructions on how to use Hermes...
Read more >
React Native: RCT-Folly fatal error - 'fmt/compile.h' file not found
I want to enable Hermes for my iOS react native project but I have next error: In file included from ../ios/Pods/RCT-Folly/folly/Singleton.cpp:35: .
Read more >
fmt | De C++ et alias OOPscenitates
The {fmt} functions do not require the programmer to match the type of the format ... To test {fmt} , I used Godbolt's...
Read more >
Internal compliler error when building in latest VS 2019 (16.11.9)
Compiler Passes: C:\Program Files (x86)\Microsoft Visual ... Version 19.29.30139.0 cl : Command line error D8003 : missing source filename ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found