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.

[iOS] Failed building app with Hermes enabled

See original GitHub issue

Bug Description

Hello, as soon as I enable Hermes on iOS in our Podfile (we are using React Native 0.64) during compilation I got this error:

Ld /Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-Core/React.framework/React normal (in target 'React-Core' from project 'Pods')
    cd /Users/marco/eSound/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-ios10.0-simulator -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk -L/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-Core -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-Core -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/DoubleConversion -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/RCT-Folly -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-cxxreact -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-jsi -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-jsiexecutor -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-jsinspector -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-perflogger -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/Yoga -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/glog -F/Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/libevent -F/Users/marco/eSound/ios/Pods/hermes-engine/destroot/Library/Frameworks/iphoneos -filelist /Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/React.LinkFileList -install_name @rpath/React.framework/React -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/React_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -lstdc++ -framework JavaScriptCore -framework hermes -framework cxxreact -framework folly -framework Foundation -framework glog -framework JavaScriptCore -framework jsi -framework jsinspector -framework jsireact -framework reactperflogger -framework yoga -Xlinker -no_adhoc_codesign -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/React_dependency_info.dat -o /Users/marco/Library/Developer/Xcode/DerivedData/eSound-djlykbztxuxzlcbyiivhgluytqpj/Build/Products/Debug-iphonesimulator/React-Core/React.framework/React

Undefined symbols for architecture x86_64:
  "double_conversion::DoubleToStringConverter::ToShortestIeeeNumber(double, double_conversion::StringBuilder*, double_conversion::DoubleToStringConverter::DtoaMode) const", referenced from:
      double_conversion::DoubleToStringConverter::ToShortest(double, double_conversion::StringBuilder*) const in MessageTypes.o
      double_conversion::DoubleToStringConverter::ToShortestSingle(float, double_conversion::StringBuilder*) const in MessageTypes.o
  "double_conversion::DoubleToStringConverter::ToFixed(double, int, double_conversion::StringBuilder*) const", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in MessageTypes.o
  "double_conversion::DoubleToStringConverter::ToPrecision(double, int, double_conversion::StringBuilder*) const", referenced from:
      std::__1::enable_if<(std::is_floating_point<double>::value) && (IsSomeString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::value), void>::type folly::toAppend<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, double>(double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, double_conversion::DoubleToStringConverter::DtoaMode, unsigned int) in MessageTypes.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What should I do?

I simply enabled the flag like this:

use_react_native!(:path => config["reactNativePath"], :hermes_enabled => true)

This is my Podfile:

platform :ios, '11.0'
use_frameworks!

pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

config = use_native_modules!
use_react_native!(:path => config["reactNativePath"], :hermes_enabled => true)

target 'eSound' do

  $RNFirebaseAsStaticFramework = true
  $RNIronSourceAsStaticFramework = true

  pod 'IronSourceSDK'
  pod 'IronSourceAdColonyAdapter'
  pod 'IronSourceAdMobAdapter'
  pod 'IronSourceAppLovinAdapter'
  pod 'IronSourceFacebookAdapter'
  pod 'IronSourceFyberAdapter'
  pod 'IronSourceTapjoyAdapter'
  pod 'IronSourceUnityAdsAdapter'
  pod 'IronSourceVungleAdapter'

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"

  pod 'react-native-discover-casts', :path => '../node_modules/react-native-discover-casts'

end

def info_post_install(installer)
  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'YES'
        if File.exist?('Pods/Target Support Files/'+target.name+'/'+target.name+'-Info.plist')
            config.build_settings['INFOPLIST_FILE'] = 'Target Support Files/'+target.name+'/'+target.name+'-Info.plist'
            #config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
        end
      end
    end

end

def enable_bitcode_in(config)
  cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
  if config.name == 'Release'
    cflags << '-fembed-bitcode'
    config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
  else
    cflags << '-fembed-bitcode-marker'
    config.build_settings['BITCODE_GENERATION_MODE'] = 'marker'
  end
  config.build_settings['OTHER_CFLAGS'] = cflags
end

def enable_bitcode_for(targets)
  targets.each do |target|
    target.build_configurations.each do |config|
      enable_bitcode_in(config)
    end
  end
end

def move_targets(targets)
  targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
      end

      if (target.name&.eql?('FBReactNativeSpec'))
        target.build_phases.each do |build_phase|
          if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
            target.build_phases.move(build_phase, 0)
          end
        end
      end
    end
end

post_install do |installer|
  info_post_install(installer)
  enable_bitcode_for(installer.pods_project.targets)
  move_targets(installer.pods_project.targets)
end

Hermes version: 0.7.2 React Native version (if any): 0.64.0 OS version (if any): MacOS Big Sur 11.2.3 Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): N/A

Steps To Reproduce

  1. Enable Hermes: use_react_native!(:path => config["reactNativePath"], :hermes_enabled => true)
  2. pod install
  3. Compile the app

What should I do?

It seems a dependency problem with DoubleConversion framework, but it should work automatically without adding it manually.

Thank you, Marco

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
matr1xpcommented, Oct 18, 2021

Was able to fix React-Core Double conversion link issue by adding the DoubleConversion.framework library under “Link Binary with Libraries” of the React-Core project under Pods. Hermes-React-Core-DoubleConversion-issue copy

0reactions
0marhcommented, Sep 1, 2021

i am also facing the same problem

System:
    OS: macOS 11.5.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 1.35 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.8.0 - /usr/local/bin/node
    Yarn: 1.22.11 - ~/Desktop/Emaar/UBE/node_modules/.bin/yarn
    npm: 6.14.14 - ~/Desktop/Emaar/UBE/node_modules/.bin/npm
    Watchman: 2021.08.23.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 28, 29, 31
      Build Tools: 29.0.0, 29.0.1, 29.0.2, 29.0.3, 31.0.0
      System Images: android-29 | Android TV Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs ARM 64 v8a, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play ARM 64 v8a, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play ARM 64 v8a, android-31 | Google Play Intel x86 Atom_64
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7621141
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.2 => 0.64.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
was having a problem using dev menu and remote debugger using legacy runtime 
so i enabled heremes in my podfile 
 
 here is how my podfile lock like 
     platform :ios, '11.0'

source 'https://github.com/CocoaPods/Specs.git'

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

$RNFirebaseAsStaticFramework = true
def common_pods
  use_frameworks!

  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/React/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'

  pod 'React-perflogger', :path => '../node_modules/react-native/ReactCommon/reactperflogger'
  pod 'React-runtimeexecutor', :path => '../node_modules/react-native/ReactCommon/runtimeexecutor'



  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNDateTimePicker', :path => '../node_modules/@react-native-community/datetimepicker'
  # pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
  # pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART'
  # pod 'Firebase/Core', '~> 6.13.0'
  # pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
  pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics'
  
  pod 'Fabric'
  pod 'TrustKit'
  pod 'RNLocalize', :path => '../node_modules/react-native-localize'
  pod 'react-native-adjust', :path => '../node_modules/react-native-adjust'
  # use_native_modules!
  pod 'GoogleIDFASupport', '~> 3.14.0'
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'
  pod 'NewRelicAgent'

end

post_install do |installer|
  react_native_post_install(installer)
  
  #fix for issue https://github.com/facebook/react-native/issues/31034
  installer.pods_project.targets.each do |target|
      if (target.name&.eql?('FBReactNativeSpec'))
        target.build_phases.each do |build_phase|
          if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
            target.build_phases.move(build_phase, 0)
          end
        end
      end
    end
  #end of fix

end

pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('RNScreens')
        def pod.build_type
          Pod::BuildType.static_library
        end
      end
    end
  end

target 'UBEA' do
  common_pods

  pod 'react-native-config', :path => '../node_modules/react-native-config'

  pod 'infobip-mobile-messaging-react-native-plugin', :path => '../node_modules/infobip-mobile-messaging-react-native-plugin'

  pod 'RNReactNativeHapticFeedback', :path => '../node_modules/react-native-haptic-feedback'

  pod 'RNSVG', :path => '../node_modules/react-native-svg'
  pod 'RNImageToPdf', :path => '../node_modules/react-native-image-to-pdf'

  pod 'blinkid-react-native', :path => '../node_modules/blinkid-react-native'


  pod 'react-native-orientation', :path => '../node_modules/react-native-orientation'

end


target 'UBEA-preproduction' do
  common_pods
end

target 'UBEA-production' do
  common_pods
end

but building fails due to errors in React-Core and DoubleConversion

Screen Shot 2021-09-01 at 1 22 41 PM

tried the solution mentioned in #23390

by adding DoubleConversion, glog and folly to link binary with libraries build phase it didn’t work

the only sloution with disable hermes and run pod install again that removed the hermes engine and libevent

then xcode was able to compile and build the app without any errors

however that returns the first issue i was trying to escape with all of this first time whenever tries to reload the app from the dev menu or connect to remote debugger the freezes and crash and you can only rebuild it again

error [native] Timed out waiting for modules to be invalidated

IMG_DD33DBF254B1-1

so my question is how should i solve this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS Build Fails w/ Hermes (RN 64) · Issue #1836 - GitHub
I attempted to repo this by cloning the example and switching the RN version to 0.64.0 and enabling Hermes branch. However, it built ......
Read more >
Using Hermes - React Native
First, ensure you're using at least version 0.60.4 of React Native to enable Hermes on Android or 0.64 of React Native to enable...
Read more >
React native build failure | Apple Developer Forums
I have a react native app that when Run from XCode it works as expected (builds and runs on a simulator). But when...
Read more >
Expo 46, EAS, react-native-firebase and hermes
Does that mean expo run:ios -d uses the classic build system, and therefore doesn't use Hermes when enabled in app.json?
Read more >
Build failed for React-Native application using Firebase ...
Build failed for React-Native application using Firebase/Firebase ... :path => config[:reactNativePath], # to enable hermes on iOS, ...
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