[iOS] Failed building app with Hermes enabled
See original GitHub issueBug 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
- Enable Hermes:
use_react_native!(:path => config["reactNativePath"], :hermes_enabled => true)
- pod install
- 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:
- Created 2 years ago
- Reactions:9
- Comments:10 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
i am also facing the same problem
but building fails due to errors in React-Core and DoubleConversion
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
so my question is how should i solve this?