A flutter plugin for OnnxRuntime provides an easy, flexible, and fast Dart API to integrate Onnx models in flutter apps across mobile and desktop platforms.
MIT License
68
stars
12
forks
source link
Failed to get symbol RegisterCustomOps with error: dlsym(0xbe91bda0, RegisterCustomOps): symbol not found #23
Add the registerCustomOpsLibrary methode void registerCustomOpsLibrary(String libPath) { final ppv = calloc<ffi.Pointer<ffi.Void>>(); final statusPtr = OrtEnv.instance.ortApiPtr.ref.RegisterCustomOpsLibrary .asFunction< bg.OrtStatusPtr Function( ffi.Pointer<bg.OrtSessionOptions>, ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Pointer<ffi.Void>>)>()(_ptr, libPath.toNativeUtf8().cast<ffi.Char>(), ppv); OrtStatus.checkOrtStatus(statusPtr); }
Add onnxruntime_extenciens in the example/android android dependency inside app/build.gradle. dependency: implementation "com.microsoft.onnxruntime:onnxruntime-extensions-android:0.9.0".
Add onnxruntime-extensions-cios pod inside the example/ios/podfile, execute pod install in the terminal and add the onnxruntime_extension.xcframework provided by the installed pod following those stepsRunner > TARGETS > Runner > build Phases > Embed Frameworks.
Go to the example folder > vad_iterator.dart > initModel method
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: code=1, message=Failed to get symbol RegisterCustomOps with error: dlsym(0xbe91bda0, RegisterCustomOps): symbol not found
#0 OrtStatus.checkOrtStatus (package:onnxruntime/src/ort_status.dart:29:5)
#1 OrtSessionOptions.registerCustomOpsLibrary (package:onnxruntime/src/ort_session.dart:273:15)
#2 VadIterator.initModel (package:onnxruntime_example/vad_iterator.dart:67:24)
I tried many solutions many of them are montioned in [https://github.com/dart-lang/native/issues/897](url) but no one works for this issue. Can any one give an explaination or have faced this issue.
Reproduction
OrtSessionOptions
class ligne 242void registerCustomOpsLibrary(String libPath) { final ppv = calloc<ffi.Pointer<ffi.Void>>(); final statusPtr = OrtEnv.instance.ortApiPtr.ref.RegisterCustomOpsLibrary .asFunction< bg.OrtStatusPtr Function( ffi.Pointer<bg.OrtSessionOptions>, ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Pointer<ffi.Void>>)>()(_ptr, libPath.toNativeUtf8().cast<ffi.Char>(), ppv); OrtStatus.checkOrtStatus(statusPtr); }
example/android
android dependency insideapp/build.gradle
. dependency:implementation "com.microsoft.onnxruntime:onnxruntime-extensions-android:0.9.0".
onnxruntime-extensions-c
ios pod inside theexample/ios/podfile
, executepod install
in the terminal and add theonnxruntime_extension.xcframework
provided by the installed pod following those stepsRunner > TARGETS > Runner > build Phases > Embed Frameworks
.initModel
methodif(Platform.isAndroid) { _sessionOptions!.registerCustomOpsLibrary('libortextensions.so'); } else if(Platform.isIOS){ _sessionOptions!.registerCustomOpsLibrary('onnxruntime_extensions.framework/onnxruntime_extensions'); }
Link to fork with reproduction
Expected result
Onnxruntime extensions registred successfully.
Actual result