react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open SaidKherif opened this issue 1 year ago • 36 comments

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 :https://github.com/facebook/react-native/commit/88b7b640a74bafd918b8b1cd5d58e1f5ddfb730
  • 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 : https://github.com/facebook/react-native/commit/88b7b640a74bafd918b8b1cd5d58e1f5ddfb730
  • Enable Hermes
  • Enable use_framework

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

image

SaidKherif avatar Aug 04 '22 12:08 SaidKherif

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.

cortinico avatar Aug 05 '22 11:08 cortinico

It is fixed here: https://github.com/facebook/react-native/commit/79baca678a743560fa16fdd551f1d0d018d34304 It is in the main branch and in 0.70.0-rc.2, but not in 0.69.3

dmytrorykun avatar Aug 05 '22 14:08 dmytrorykun

still happens on 0.70

lightrow avatar Sep 06 '22 17:09 lightrow

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

Kudo avatar Sep 07 '22 07:09 Kudo

@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

lightrow avatar Sep 07 '22 11:09 lightrow

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

Minishlink avatar Sep 07 '22 12:09 Minishlink

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

lightrow avatar Sep 07 '22 12:09 lightrow

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)

tapz avatar Sep 10 '22 18:09 tapz

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)

itsramiel avatar Sep 13 '22 07:09 itsramiel

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.

mmelk avatar Sep 15 '22 12:09 mmelk

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,

Hugyn avatar Oct 01 '22 15:10 Hugyn

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')

avenable8 avatar Oct 07 '22 18:10 avenable8

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}/.."
  )

HugoGresse avatar Oct 10 '22 15:10 HugoGresse

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])

tapz avatar Oct 13 '22 10:10 tapz

@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.

avenable8 avatar Oct 13 '22 18:10 avenable8

@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.

tapz avatar Oct 13 '22 20:10 tapz

Also getting this error on RN 0.70.3

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

jorgegvallejo avatar Oct 18 '22 19:10 jorgegvallejo

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

anhtuank7c avatar Oct 28 '22 03:10 anhtuank7c

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 avatar Oct 31 '22 10:10 GrimDev

@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

anhtuank7c avatar Nov 01 '22 02:11 anhtuank7c

try https://github.com/Jichao/react-native/commit/f54159f774b57d7d2380ce51a9fa2e4a8c6ee039 add s.dependency "React-hermes", version to react-core.podspec

Jichao avatar Nov 08 '22 03:11 Jichao

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!
    .....

appli-intramuros avatar Nov 08 '22 18:11 appli-intramuros

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

anwersolangi avatar Nov 13 '22 20:11 anwersolangi

Do not use static linkage,

Jichao avatar Nov 14 '22 04:11 Jichao

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?

sourabh-epam avatar Nov 14 '22 13:11 sourabh-epam

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?

anwersolangi avatar Nov 14 '22 17:11 anwersolangi

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

ste7en avatar Nov 14 '22 20:11 ste7en

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

Jichao avatar Nov 16 '22 04:11 Jichao

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

anwersolangi avatar Nov 16 '22 04:11 anwersolangi

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

aprilmintacpineda avatar Dec 04 '22 09:12 aprilmintacpineda