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

Failed to get symbol RegisterCustomOps with error: dlsym(0xbe91bda0, RegisterCustomOps): symbol not found #23

Open
saddemYassin opened this issue May 31, 2024 · 0 comments

Comments

@saddemYassin
Copy link

Reproduction

  1. Fork the onnxruntime_flutter
  2. Go to lib/src/ort_session.dart
  3. Inside the OrtSessionOptions class ligne 242
  4. 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); }
  5. Add onnxruntime_extenciens in the example/android android dependency inside app/build.gradle. dependency: implementation "com.microsoft.onnxruntime:onnxruntime-extensions-android:0.9.0".
  6. 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.
  7. Go to the example folder > vad_iterator.dart > initModel method
  8. Add the registerCustomOps implementation if(Platform.isAndroid) { _sessionOptions!.registerCustomOpsLibrary('libortextensions.so'); } else if(Platform.isIOS){ _sessionOptions!.registerCustomOpsLibrary('onnxruntime_extensions.framework/onnxruntime_extensions'); }
  9. Run the application on both android and ios platforms

Link to fork with reproduction

Expected result

Onnxruntime extensions registred successfully.

Actual result

  1. Android works fine
  2. Ios shows the following error:
[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 but no one works for this issue. Can any one give an explaination or have faced this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant