Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_framework! + hermes enable = Undefined symbols "vtable for facebook::react::HermesExecutorFactory" #34344

Closed
SaidKherif opened this issue Aug 4, 2022 · 43 comments
Labels
Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Hermes Hermes Engine: https://hermesengine.dev/

Comments

@SaidKherif
Copy link

SaidKherif commented Aug 4, 2022

Description

Hi guys,

I'm trying to use hermes with use_framework!.

  • I was on 0.66.4, with hermes disabled and use_framework enabled. My app was working great, but on some Android device i got a crash from JSC so we decided to enable hermes.
  • I tried to use both hermes and use_framework but it don't work. After some research i understand i have to upgrade RN to 0.69.3.
  • After Upgrade i got an issue wich was fixed by this PR :88b7b64
  • I patched react-native to integrate this PR

After the patch i got another issue:

Undefined symbols for architecture x86_64:
"vtable for facebook::react::HermesExecutorFactory", referenced from:
facebook::react::HermesExecutorFactory::HermesExecutorFactory(std::__1::function<void (facebook::jsi::Runtime&)>, std::__1::function<void (std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > ()>)> const&, hermes::vm::RuntimeConfig) in RCTCxxBridge.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Someone know how i can fix this issue ? Cause for now, i can't use hermes and use_framework together on all version of RN

Version

0.69.3

Output of npx react-native info

System:
OS: macOS 12.0.1
CPU: (10) x64 Apple M1 Pro
Memory: 135.61 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v14.17.0/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
Watchman: 2022.05.16.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.10.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7935034
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.3 => 0.69.3
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  • Upgrade RN from 0.66.4 -> 0.69.3
  • Patch RN with : 88b7b64
  • Enable Hermes
  • Enable use_framework

Snack, code example, screenshot, or link to a repository

image

@cortinico cortinico added Platform: iOS iOS applications. Tech: Hermes Hermes Engine: https://hermesengine.dev/ and removed Needs: Triage 🔍 labels Aug 5, 2022
@cortinico
Copy link
Contributor

I'm trying to use hermes with use_framework!.

I don't think Hermes currently supports use_framework. @dmitryrykun @neildhar @Kudo and other folks might have more context than me on this.

@dmytrorykun
Copy link
Contributor

dmytrorykun commented Aug 5, 2022

It is fixed here: 79baca6
It is in the main branch and in 0.70.0-rc.2, but not in 0.69.3

@lightrow
Copy link

lightrow commented Sep 6, 2022

still happens on 0.70

@Kudo
Copy link
Contributor

Kudo commented Sep 7, 2022

@lightrow could you share more details? it works for me on a blank 0.70 project.

@lightrow
Copy link

lightrow commented Sep 7, 2022

@lightrow could you share more details? it works for me on a blank 0.70 project.

ah i just realized it's slightly different

Undefined symbols for architecture arm64:
  "vtable for facebook::react::HermesExecutorFactory", referenced from:
      facebook::react::HermesExecutorFactory::HermesExecutorFactory(std::__1::function<void (facebook::jsi::Runtime&)>, std::__1::function<void (std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > ()>)> const&, hermes::vm::RuntimeConfig) in RCTCxxBridge.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

arm64 instead of x86_64. I have an M1

@Minishlink
Copy link
Contributor

Minishlink commented Sep 7, 2022

I also have this problem (without an M1 and with architecture x86_64)
Fabric is disabled
Flipper is disabled (won't work with use_framework anyway)
Derived data and build folder are clean
XCode 13.4.1

System:
    OS: macOS 12.5.1
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 1.64 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/Library/Caches/fnm_multishells/40339_1662544747645/bin/node
    Yarn: 1.22.18 - ~/Library/Caches/fnm_multishells/40339_1662544747645/bin/yarn
    npm: 8.5.5 - ~/Library/Caches/fnm_multishells/40339_1662544747645/bin/npm
    Watchman: 2022.02.28.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /Users/louislagrange/.rvm/gems/ruby-2.7.2/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0
      System Images: android-31 | Google Play Intel x86 Atom_64, android-33 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
  IDEs:
    Android Studio: Chipmunk 2021.2.1 Patch 2 Chipmunk 2021.2.1 Patch 2
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.12 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.0 => 0.70.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

@lightrow
Copy link

lightrow commented Sep 7, 2022

I also just tested with an empty project, only added use_frameworks! to Podfile and got the same error
image

arch -x86_64 pod install and running Xcode with Rosetta results in the same error with x86_64 instead of arm64

@tapz
Copy link

tapz commented Sep 10, 2022

I have this issue too in my Intel Mac. I have never been able to build for iOS with Hermes enabled. 0.70.0 did not change this.

Undefined symbols for architecture arm64:
  "vtable for facebook::react::HermesExecutorFactory", referenced from:
      facebook::react::HermesExecutorFactory::HermesExecutorFactory(std::__1::function<void (facebook::jsi::Runtime&)>, std::__1::function<void (std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > ()>)> const&, hermes::vm::RuntimeConfig) in RCTCxxBridge.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@itsramiel
Copy link

Experiencing this too:

Undefined symbols for architecture x86_64:
  "vtable for facebook::react::HermesExecutorFactory", referenced from:
      facebook::react::HermesExecutorFactory::HermesExecutorFactory(std::__1::function<void (facebook::jsi::Runtime&)>, std::__1::function<void (std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > ()>)> const&, hermes::vm::RuntimeConfig) in RCTCxxBridge.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

/Users/ramiel/Desktop/Typescript/reactNative/Notifications/ios/Pods/Pods.xcodeproj: warning: MobileCoreServices has been renamed. Use CoreServices instead. (in target 'React-RCTNetwork' from project 'Pods')

2022-09-13 10:06:41.363 xcodebuild[3447:3681217] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-09-13 10:06:41.364 xcodebuild[3447:3681217] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **


The following build commands failed:
	Ld /Users/ramiel/Library/Developer/Xcode/DerivedData/Notifications-dclqlkvlkajkvcdnlodvgezguaav/Build/Products/Debug-iphonesimulator/React-Core/React.framework/React normal (in target 'React-Core' from project 'Pods')
(1 failure)

@mmelk
Copy link

mmelk commented Sep 15, 2022

I think we must use frameworks like this

use_frameworks! :linkage => :static

In my case, I am using Firebase, and with react-native 0.70 and Firebase v9+ the docs advised to use this way.

@Hugyn
Copy link

Hugyn commented Oct 1, 2022

I think we must use frameworks like this

use_frameworks! :linkage => :static

In my case, I am using Firebase, and with react-native 0.70 and Firebase v9+ the docs advised to use this way.

This solved my issue
use_frameworks! :linkage => :static

and commented out
:flipper_configuration => FlipperConfiguration.enabled,

@avenable8
Copy link

avenable8 commented Oct 7, 2022

I am having this same issue after upgrading to 0.70.2.

use_frameworks! :linkage => :static does not work for me. We are integrating react native into an existing native app that heavily uses Bond, which requires use_frameworks! and does not work with the static linking.

I also tried selectively statically/dynamically linking pods targets (https://stackoverflow.com/questions/37388126/use-frameworks-for-only-some-pods-or-swift-pods). This gets rid of the hermes error, but we are using Bond in our project and this results in a bond issue (Include of non-modular header inside framework module 'Bond.Bond')

@HugoGresse
Copy link

HugoGresse commented Oct 10, 2022

Weirdly enough, I'm having the same issue, but I'm not using use_frameworks in the podfile and migrating from 0.67 to 0.68.
Applying the patch mentionned in the OP did not change anything too. And I'm still on Intel Mac...

Undefined symbols for architecture x86_64:
  "vtable for facebook::react::HermesExecutorFactory", referenced from:
      facebook::react::HermesExecutorFactory::HermesExecutorFactory(std::__1::function<void (facebook::jsi::Runtime&)>, std::__1::function<void (std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > ()>)> const&, hermes::vm::RuntimeConfig) in libReact-Core.a(RCTCxxBridge.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution:

The new env where not populated because I didn't had any .xcode.env so I just replaced the flags to static bool:

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => true,
    :fabric_enabled => false,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

@tapz
Copy link

tapz commented Oct 13, 2022

I managed to build for iOS with Hermes enabled with use_frameworks! :linkage => :static, but the app crashes at startup:

Error: Font failed to load
  at apply(node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:105:55)
  at ? (node_modules/react-native-vector-icons/lib/create-icon-set.js:175:13)
  at generatorResume([native code])
  at asyncGeneratorStep(node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:20)
  at _next(node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
  at fn(node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:7)
  at tryCallTwo(node_modules/promise/setimmediate/core.js:45:5)
  at doResolve(node_modules/promise/setimmediate/core.js:200:13)
  at Promise(node_modules/promise/setimmediate/core.js:66:3)
  at apply(node_modules/@babel/runtime/helpers/asyncToGenerator.js:19:16)
  at _loadFont(node_modules/react-native-vector-icons/lib/create-icon-set.js:26:3)
  at loadFont(node_modules/react-native-vector-icons/lib/create-icon-set.js:26:3)
  at ? (src/App.js:312:12)
  at generatorResume([native code])
  at asyncGeneratorStep(node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:20)
  at _next(node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
  at fn(node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:7)
  at tryCallTwo(node_modules/promise/setimmediate/core.js:45:5)
  at doResolve(node_modules/promise/setimmediate/core.js:200:13)
  at Promise(node_modules/promise/setimmediate/core.js:66:3)
  at apply(node_modules/@babel/runtime/helpers/asyncToGenerator.js:19:16)
  at _init(src/App.js:100:21)
  at init(src/App.js:100:21)
  at ? (src/App.js:622:11)
  at generatorResume([native code])
  at asyncGeneratorStep(node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:20)
  at _next(node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:9)
  at fn(node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:7)
  at tryCallTwo(node_modules/promise/setimmediate/core.js:45:5)
  at doResolve(node_modules/promise/setimmediate/core.js:200:13)
  at Promise(node_modules/promise/setimmediate/core.js:66:3)
  at apply(node_modules/@babel/runtime/helpers/asyncToGenerator.js:19:16)
  at _componentDidMountAsync(src/App.js:100:21)
  at componentDidMountAsync(src/App.js:100:21)
  at create$73(src/App.js:143:5)
  at commitHookEffectListMount(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:5828:26)
  at flushPassiveEffects(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7532:23)
  at d(node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7371:7)
  at J(node_modules/scheduler/cjs/scheduler.production.min.js:13:203)
  at R(node_modules/scheduler/cjs/scheduler.production.min.js:14:128)
  at callback(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:248:18)
  at _callTimer(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:112:7)
  at _callReactNativeMicrotasksPass(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:162:5)
  at _reactNativeMicrotasksCallback(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:413:12)
  at __callReactNativeMicrotasks(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:390:12)
  at fn(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:132:12)
  at __guard(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:367:9)
  at value(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:131:10)
  at value([native code])
  at value([native code])

@avenable8
Copy link

@tapz I also had this issue with MaterialCommunity from react-native-vector-icons. I got around it by selectively statically + dynamically loading pod targets instead of globally using :linkage => :static. I posted the stackoverflow link above.

@tapz
Copy link

tapz commented Oct 13, 2022

@avenable8 I have no idea, which ones to set static and which dynamic. I'll just disable Hermes and wait until it and all dependencies are mature enough.

@jorgegvallejo
Copy link

Also getting this error on RN 0.70.3

use_frameworks! :linkage => :static
didn't help

@anhtuank7c
Copy link

Config frameworks like this use_frameworks! :linkage => :static and disable flipper# :flipper_configuration => FlipperConfiguration.enabled, works for me

@GrimDev
Copy link

GrimDev commented Oct 31, 2022

Still having the same issue with use_frameworks! :linkage => :static and disabled flipper.

Here is my config, any advice ?

RN 0.70.4

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

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
use_frameworks! :linkage => :static

$RNFirebaseAsStaticFramework = true

target 'Tellingtone' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()
  
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => true

  use_react_native!(
    :path => config[:reactNativePath],
    
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => false,
    
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    #:flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage'
  pod 'RNFS', :path => '../node_modules/react-native-fs'

  target 'TellingtoneTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

@anhtuank7c
Copy link

@GrimDev
This is mine

# iOS 14.5
# RNFBAnalytics: Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps
$RNFirebaseAnalyticsWithoutAdIdSupport=true
$RNFirebaseAsStaticFramework = true

# $FirebaseSDKVersion = '7.0.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

target 'demo' do
  use_frameworks! :linkage => :static
  inhibit_all_warnings!
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'

  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  
    installer.pod_targets.each do |pod|
      if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-') || pod.name.eql?('RNVectorIcons')
        def pod.build_type;
          # Uncomment the line corresponding to your CocoaPods version
          Pod::BuildType.static_library # >= 1.9
          # Pod::Target::BuildType.static_library # < 1.9
        end
      end
    end
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      end
    end
  end
end

@Jichao
Copy link

Jichao commented Nov 8, 2022

try Jichao@f54159f
add
s.dependency "React-hermes", version
to react-core.podspec

@appli-intramuros
Copy link

Still having the same issue with use_frameworks! :linkage => :static and disabled flipper.

Here is my config, any advice ?

RN 0.70.4

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

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false
use_frameworks! :linkage => :static

$RNFirebaseAsStaticFramework = true

target 'Tellingtone' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()
  
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => true

  use_react_native!(
    :path => config[:reactNativePath],
    
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => false,
    
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    #:flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage'
  pod 'RNFS', :path => '../node_modules/react-native-fs'

  target 'TellingtoneTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

@GrimDev
Try to set "use_frameworks! :linkage => :static" inside the target like this:

target 'Tellingtone' do
    use_frameworks! :linkage => :static    <--- HERE
    config = use_native_modules!
    .....

@anwersolangi
Copy link

Hello Please anyone helpme out, I'm struggling with the error from few days, I only encounter the error when archiving the app, I tried the solution of @Jichao , however I'm now getting another error in the RNRenimated:

Undefined symbols for architecture arm64:
  "facebook::hermes::makeHermesRuntime(hermes::vm::RuntimeConfig const&)", referenced from:
      reanimated::createReanimatedModule(RCTBridge*, std::__1::shared_ptr<facebook::react::CallInvoker>) in NativeProxy.o
ld: symbol(s) not found for architecture arm64

Undefined symbol: facebook::hermes::makeHermesRuntime(hermes::vm::RuntimeConfig const&)

here is my Podfile

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

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

production = ENV["PRODUCTION"] == "1"

target 'OneSignalNotificationExtension' do
  use_frameworks!
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end

target 'Nearby' do
  use_frameworks! :linkage => :static

  $static_framework = []
  rn_maps_path = '../node_modules/react-native-maps'
  config = use_native_modules!
  use_frameworks!
  
  $static_framework += [
    'react-native-maps',
    'react-native-google-maps',
    'Google-Maps-iOS-Utils',
    'GoogleMaps',
    'RNPermissions',
    'Permission-LocationWhenInUse',
    'Permission-Notifications',
    'Permission-Microphone',
    'Permission-MediaLibrary',
    'Permission-PhotoLibrary',
    'Permission-Camera',
    'Permission-LocationWhenInUse',
    'Permission-LocationAlways',
    'Permission-LocationAccuracy',
    'react-native-mmkv',
  ]
  
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'
  $RNFirebaseAsStaticFramework = true
  $RNGoogleMobileAdsAsStaticFramework = true
  permissions_path = '../node_modules/react-native-permissions/ios'

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

  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" 

  pre_install do |installer|
      Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
          installer.pod_targets.each do |pod|
            if $static_framework.include?(pod.name) || pod.name.start_with?('Permission-')
                  def pod.build_type;
                    Pod::BuildType.static_library
              end
          end
      end
  end
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'NearbyTests' do
    inherit! :complete
    # Pods for testing
  end
  # use_flipper!
post_install do |installer|

  react_native_post_install(
    installer,
    # Set `mac_catalyst_enabled` to `true` in order to apply patches
    # necessary for Mac Catalyst builds
    :mac_catalyst_enabled => false
  )
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
 installer.pods_project.targets.each do |target|
  target.build_configurations.each do |config|
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
    config.build_settings['ENABLE_BITCODE'] = 'NO'
  end
 end
#  installer.pods_project.build_configurations.each do |config|
#    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
#  end
end
end

Any help is really appreciated

@Jichao
Copy link

Jichao commented Nov 14, 2022

Do not use static linkage,

@sourabh-epam
Copy link

sourabh-epam commented Nov 14, 2022

s.dependency "React-hermes", version
to react-core.podspec

Thanks a lot! It works for me with RN 0.70.5 with Hermes Enabled without static linkage for use_frameworks!. Any Idea when it will going to merge in RN update?

@anwersolangi
Copy link

Do not use static linkage,

After this, I'm getting error in the Reanimated Pod:

Undefined symbols for architecture arm64:
  "facebook::hermes::makeHermesRuntime(hermes::vm::RuntimeConfig const&)", referenced from:
      reanimated::createReanimatedModule(RCTBridge*, std::__1::shared_ptr<facebook::react::CallInvoker>) in NativeProxy.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbol: facebook::hermes::makeHermesRuntime(hermes::vm::RuntimeConfig const&)
Anyone else getting the same error?

@ste7en
Copy link

ste7en commented Nov 14, 2022

try Jichao@f54159f
add
s.dependency "React-hermes", version
to react-core.podspec

For me applying this patch resulted in the following error from RCTThirdPartyFabricComponentsProvider.h in pod React-Codegen:
... /ios/build/generated/ios/RCTThirdPartyFabricComponentsProvider.h:14:9: error build: 'React/RCTComponentViewProtocol.h' file not found

my Podfile has use_framework! without static linkage

@Jichao
Copy link

Jichao commented Nov 16, 2022

Do not use static linkage,

After this, I'm getting error in the Reanimated Pod:


Undefined symbols for architecture arm64:

  "facebook::hermes::makeHermesRuntime(hermes::vm::RuntimeConfig const&)", referenced from:

      reanimated::createReanimatedModule(RCTBridge*, std::__1::shared_ptr<facebook::react::CallInvoker>) in NativeProxy.o

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbol: facebook::hermes::makeHermesRuntime(hermes::vm::RuntimeConfig const&)

Anyone else getting the same error?

I have only tested on 0.70.2, maybe spec the version in pod file

@anwersolangi
Copy link

Thanks alot for your help, actually the issue was with react-native-reanimated, I managed to solve this issue. Thanks!

@aprilmintacpineda
Copy link

I think we must use frameworks like this

use_frameworks! :linkage => :static

In my case, I am using Firebase, and with react-native 0.70 and Firebase v9+ the docs advised to use this way.

This one worked for me

@Mrezagolbaba
Copy link

Mrezagolbaba commented Dec 5, 2022

1- use_frameworks! :linkage => :static (inside target 'projectName' do)
2- disabled :flipper_configuration => FlipperConfiguration.enabled
3- add s.dependency "React-hermes", version in side /node_modules/react-native/React-Core.podspec

works for me in Recat Native 0.70.6

@sudharsanvishnu
Copy link

im also facing this issue in rn-0.70.2
tried below steps

1- use_frameworks! :linkage => :static (inside target 'projectName' do) 2- disabled :flipper_configuration => FlipperConfiguration.enabled 3- add s.dependency "React-hermes", version in side /node_modules/react-native/React-Core.podspec

works for me in Recat Native 0.70.6

@YAMMOUNII
Copy link

same error
The following build commands failed: Ld /Users/user/Library/Developer/Xcode/DerivedData/Elnashra-hjdnhtbsafvjvofifgzvhxjxpzcd/Build/Products/Debug-iphonesimulator/React-Core/React.framework/React normal (1 failure)
what can i do ?

@acro5piano
Copy link

use_frameworks! :linkage => :static

Thank you, it works! on 0.70.6

@nandha-kumar-hajari
Copy link

Adding this fixed it for me
image

@filipecatraia
Copy link

@Mrezagolbaba This makes the build progress, but still fails with ld: 98 duplicate symbols for architecture arm64. I installed the default RN repo, ran it successfully, went for a walk, and by the time I came back the project no longer built with the issues above.

@douugdev
Copy link

douugdev commented Jan 18, 2023

For those who can't use use_frameworks! :linkage => :static, you can manually convert only react-specific libraries by doing:

use_frameworks!

$static_framework = [ 'YogaKit', 'RCT-Folly', 'RCTTypeSafety', 'ReactCommon']
  pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  
    installer.pod_targets.each do |pod|
      if pod.name.start_with?('React-') || $static_framework.include?(pod.name)
        def pod.build_type;
          # Uncomment the line corresponding to your CocoaPods version
          # Pod::BuildType.static_library # >= 1.9
          # Pod::Target::BuildType.static_library # < 1.9
        end
      end
    end
  end

You can also add other frameworks/libraries to the $static_framework list to convert it as well.
Tested on RN 0.70.6.

@Shubhambhagatofficial
Copy link

Shubhambhagatofficial commented Jan 24, 2023

Thank you. @Jichao
Saved my week's work.

this worked
add
s.dependency "React-hermes", version
to react-core.podspec

and remove static linkage from your pod file

@MarinaAmy
Copy link

@Mrezagolbaba This makes the build progress, but still fails with ld: 98 duplicate symbols for architecture arm64. I installed the default RN repo, ran it successfully, went for a walk, and by the time I came back the project no longer built with the issues above.

I have the same problem:

818 duplicate symbols for architecture arm64 on my project.

I'm not sure how to fix it, but I've been running around in circles for a few days now :/

I've put the line use_frameworks in my podfile! :linkage => :static and I activated hermes

Thank you !

@paulopgss
Copy link

I think we must use frameworks like this

use_frameworks! :linkage => :static

In my case, I am using Firebase, and with react-native 0.70 and Firebase v9+ the docs advised to use this way.

nice, it saved me... thank you

@bartkoedijk
Copy link

React-native: 0.72.0
@react-native-firebase/app: 18.1.0

I had the same issue. I cleaned my IOS build folder in Xcode (Product -> Clean Build folder)

Then I added the following line in multiple files;

s.dependency 'React-hermes', version
node_modules/react-native/RNReanimated.podsec ,
node_modules/react-native/React.podspec,
node_modules/react-native-reanimated/React-Core.podspec

I changed the following in the Podfile:

    :hermes_enabled => true,
    :fabric_enabled => false,
    # :flipper_configuration => flipper_config,
    use_frameworks! :linkage => :static

If you are upgrading your react native version this repo might help you. This maintainer has a repo with the release versions for a basic react native application, the branches shows the release version:
https://github.com/react-native-community/rn-diff-purge/tree/release/0.72.0
Or if you would like to compare the changes you can use this website;
https://react-native-community.github.io/upgrade-helper/

Hope it helped someone :)

Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 14, 2024
Copy link

github-actions bot commented Feb 5, 2024

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon. Tech: Hermes Hermes Engine: https://hermesengine.dev/
Projects
None yet
Development

Successfully merging a pull request may close this issue.