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

🔧 undefined symbol: RNWorklet::JsiWorkletContext::getWorkletRuntime()

Open Danushka96 opened this issue 1 year ago • 6 comments

How were you trying to build the app?

I updated Vision Camera 3.4.0 due to the fps dropping issue in Android in the previous version. Previously it was built without issue. But after update I got this build issue

Works with VisionCamera_disableFrameProcessors = true in gradle-wrapper.properties

buildToolsVersion = "33.0.0"
kotlinVersion = "1.7.0"
kotlin_version = "1.7.0"
minSdkVersion = 26
compileSdkVersion = 33
targetSdkVersion = 33

Can I disable it if I need to use CodeScanner feature?

Full build logs

error: undefined symbol: RNWorklet::JsiWorkletContext::getWorkletRuntime()
  >>> referenced by JFrameProcessor.cpp:37 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-vision-camera/android/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp:37)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(vision::JFrameProcessor::callWithFrameHostObject(std::__ndk1::shared_ptr<vision::FrameHostObject> const&) const)
  >>> referenced by JVisionCameraProxy.cpp:57 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-vision-camera/android/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp:57)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vision::JVisionCameraProxy::~JVisionCameraProxy())
  
  ld: error: undefined symbol: RNWorklet::JsiWorkletContext::invokeOnJsThread(std::__ndk1::function<void (facebook::jsi::Runtime&)>&&)
  >>> referenced by JFrameProcessor.cpp:50 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-vision-camera/android/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp:50)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(vision::JFrameProcessor::callWithFrameHostObject(std::__ndk1::shared_ptr<vision::FrameHostObject> const&) const)
  >>> referenced by WKTJsiWorklet.h:368 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:368)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::~WorkletInvoker())
  
  ld: error: undefined symbol: RNWorklet::JsiWorkletContext::runtimeMappings
  >>> referenced by __tree:0 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__tree:0)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::call(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long))
  >>> referenced by __tree:0 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__tree:0)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::call(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long))
  
  ld: error: undefined symbol: RNWorklet::JsiWorkletContext::invokeOnWorkletThread(std::__ndk1::function<void (RNWorklet::JsiWorkletContext*, facebook::jsi::Runtime&)>&&)
  >>> referenced by WKTJsiWorklet.h:371 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:371)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::WorkletInvoker::~WorkletInvoker())
  
  ld: error: undefined symbol: RNWorklet::JsiWorkletContext::defaultInstance
  >>> referenced by memory:3887 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:3887)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance())
  >>> referenced by memory:3887 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:3887)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance())
  
  ld: error: undefined symbol: RNWorklet::JsiHostObject::JsiHostObject()
  >>> referenced by WKTJsiWorkletContext.h:31 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorkletContext.h:31)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance())
  >>> referenced by WKTJsiWorklet.h:77 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:77)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::JsiWorklet(facebook::jsi::Runtime&, facebook::jsi::Value const&))
  
  ld: error: undefined symbol: vtable for RNWorklet::JsiWorkletContext
  >>> referenced by WKTJsiWorkletContext.h:31 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorkletContext.h:31)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance())
  >>> referenced by WKTJsiWorkletContext.h:31 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorkletContext.h:31)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(RNWorklet::JsiWorkletContext::getDefaultInstance())
  >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
  
  ld: error: undefined symbol: RNWorklet::JsiWorkletContext::~JsiWorkletContext()
  >>> referenced by memory:2252 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2252)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(std::__ndk1::__shared_ptr_emplace<RNWorklet::JsiWorkletContext, std::__ndk1::allocator<RNWorklet::JsiWorkletContext> >::~__shared_ptr_emplace())
  >>> referenced by memory:2252 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2252)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp.o:(std::__ndk1::__shared_ptr_emplace<RNWorklet::JsiWorkletContext, std::__ndk1::allocator<RNWorklet::JsiWorkletContext> >::~__shared_ptr_emplace())
  
  ld: error: undefined symbol: RNWorklet::JsiWorkletContext::JsiWorkletContext(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::jsi::Runtime*, std::__ndk1::function<void (std::__ndk1::function<void ()>&&)>, std::__ndk1::function<void (std::__ndk1::function<void ()>&&)>)
  >>> referenced by memory:2278 (/Users/danushkaherath/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2278)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vision::JVisionCameraProxy::JVisionCameraProxy(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<vision::JVisionCameraProxy, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*> const&, facebook::jsi::Runtime*, std::__ndk1::shared_ptr<facebook::react::CallInvoker> const&, facebook::jni::basic_strong_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<vision::JVisionCameraScheduler, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*, facebook::jni::GlobalReferenceAllocator> const&))
  
  ld: error: undefined symbol: RNWorklet::JsiHostObject::~JsiHostObject()
  >>> referenced by WKTJsiWorklet.h:79 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:79)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::JsiWorklet(facebook::jsi::Runtime&, facebook::jsi::Value const&))
  >>> referenced by WKTJsiWorklet.h:74 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWorklet.h:74)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::~JsiWorklet())
  
  ld: error: undefined symbol: RNWorklet::JsiWrapper::wrap(facebook::jsi::Runtime&, facebook::jsi::Value const&, RNWorklet::JsiWrapper*)
  >>> referenced by WKTJsiWrapper.h:62 (/Users/danushkaherath/BeepMerchant/node_modules/react-native-worklets-core/android/build/headers/rnworklets/react-native-worklets-core/WKTJsiWrapper.h:62)
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(RNWorklet::JsiWorklet::createWorklet(facebook::jsi::Runtime&, std::__ndk1::shared_ptr<facebook::jsi::Function>))
  
  ld: error: undefined symbol: RNWorklet::JsiHostObject::get(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&)
  >>> referenced by JVisionCameraProxy.cpp
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vtable for RNWorklet::JsiWorklet)
  
  ld: error: undefined symbol: RNWorklet::JsiHostObject::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&)
  >>> referenced by JVisionCameraProxy.cpp
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vtable for RNWorklet::JsiWorklet)
  
  ld: error: undefined symbol: RNWorklet::JsiHostObject::getPropertyNames(facebook::jsi::Runtime&)
  >>> referenced by JVisionCameraProxy.cpp
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(vtable for RNWorklet::JsiWorklet)
  
  ld: error: undefined symbol: typeinfo for RNWorklet::JsiHostObject
  >>> referenced by JVisionCameraProxy.cpp
  >>>               CMakeFiles/VisionCamera.dir/src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp.o:(typeinfo for RNWorklet::JsiWorklet)
  clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

Project dependencies

"dependencies": {
  "react-native": "0.72.5",
  "react-native-reanimated": "^3.5.4",
  "react-native-vision-camera": "^3.4.0",
  "react-native-worklets-core": "^0.2.2",
}

VisionCamera Version

3.4.0

Target platforms

Android

Operating system

MacOS

Can you build the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

Danushka96 avatar Oct 16 '23 16:10 Danushka96

check this: https://github.com/mrousavy/react-native-vision-camera/issues/1770#issuecomment-1707550362 maybe can help

Fabianurrutia avatar Oct 16 '23 16:10 Fabianurrutia

Can I disable it if I need to use CodeScanner feature?

Yes, FPs can be disabled and the CodeScanner will still work.

If you dont install react-native-worklets-core, it should work right?

mrousavy avatar Oct 17 '23 10:10 mrousavy

Yes, Working without issue when removing react-native-worklets-core from the project.

Danushka96 avatar Oct 18 '23 17:10 Danushka96

Hi, just updated to v3.6.6 and noticed in the changelog that this issue should be fixed by https://github.com/mrousavy/react-native-vision-camera/commit/75fd9248996caeccccec65da8f6c950c8d440e47

After a a clean install of my project, I get the undefined symbol: RNWorklet::JsiWorkletContext::getWorkletRuntime() error when building via npm run react-native run-android.

However, building via Android Studio (Giraffe | 2022.3.1 Patch 2) succeeds. Then subsequent builds via npm run react-native run-android will also succeed.

gradlew clean will make the build error return and another single build via Android Studio fixes it.

I went back through my project's history use of RNVC v3 and this issue has always been there. I never noticed it before as I typically kick off builds via Android Studio.

I have no idea why Android Studio builds would behave differently to npm run react-native run-android.

Build Error Log: rnvc-build-error.txt

Edit: Deleting the ./android/.gradle folder appears to have resolved my issue. Building fine now from commandline.

ldstein avatar Nov 16 '23 00:11 ldstein

Anytime i change other expo libraries dependancies that require a new dev-client, the android compile fails for the above error (undefined symbol: RNWorklet::JsiWorkletContext::getWorkletRuntime() error when building via npm run react-native run-android) . I have to delete the /android/.gradle folder (as noted by @ldstein). I havent had to do this for any other library ive played with thus far.

Either im doing something wrong (only been playing with react-native for a few months so, very possible), or there still is something fishy going on.

Zoxive avatar Dec 09 '23 20:12 Zoxive

Maybe some caching issue. I still don't know why this happens, I am focusing on higher priority issues at the moment. But if someone fixes this, I'll happily accept PRs here! ❤️

mrousavy avatar Dec 12 '23 12:12 mrousavy

It builds fine for me, both in VisionCamera and in a new RN app.

mrousavy avatar Jan 15 '24 12:01 mrousavy

Hello, I cleared the cache according to the instructions but the error still occurs, please help me. Thankyou very much.

image

@mrousavy

DevMinhThu avatar Mar 05 '24 04:03 DevMinhThu