react-native: use_framework! + hermes enable = Undefined symbols "vtable for facebook::react::HermesExecutorFactory"
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<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)
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 12
- Comments: 43 (4 by maintainers)
Commits related to this issue
- fix use_framework! + hermes enable link failed (#34344) — committed to Jichao/react-native by deleted user 2 years ago
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.
still happens on 0.70
try https://github.com/Jichao/react-native/commit/f54159f774b57d7d2380ce51a9fa2e4a8c6ee039 add
s.dependency "React-hermes", version
to react-core.podspecI also just tested with an empty project, only added
use_frameworks!
to Podfile and got the same errorarch -x86_64 pod install
and running Xcode with Rosetta results in the same error with x86_64 instead of arm64I 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.
This solved my issue use_frameworks! :linkage => :static
and commented out
:flipper_configuration => FlipperConfiguration.enabled,
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
1-
use_frameworks! :linkage => :static
(inside target ‘projectName’ do) 2- disabled:flipper_configuration => FlipperConfiguration.enabled
3- adds.dependency "React-hermes", version
in side/node_modules/react-native/React-Core.podspec
works for me in Recat Native 0.70.6
Still having the same issue with
use_frameworks! :linkage => :static
and disabled flipper.Here is my config, any advice ?
RN 0.70.4
@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.
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.podspecI changed the following in the Podfile:
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 😃
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 !
For those who can’t use
use_frameworks! :linkage => :static
, you can manually convert only react-specific libraries by doing:You can also add other frameworks/libraries to the
$static_framework
list to convert it as well. Tested on RN 0.70.6.This one worked for me
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?
@GrimDev Try to set “use_frameworks! :linkage => :static” inside the target like this: