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

Failing to get instance on archived iOS bundles. #24

Open
smilingjack10 opened this issue Jun 3, 2024 · 4 comments
Open

Failing to get instance on archived iOS bundles. #24

smilingjack10 opened this issue Jun 3, 2024 · 4 comments

Comments

@smilingjack10
Copy link

The plugin works perfectly when used on iOS applications that were build from flutter or Xcode, both in debug as in release mode. However, once packaged into an IPA in order to upload to the App Store the onnxruntime plugin cannot be found anymore.
I tried forcing to link the library in Xcode but this didn't resolve anything.
Also tried: cleaning the project both from Xcode and VSCode, create a new project, other physical device. Nothing helped.
When I connect the console to my physical iOS device I get the following error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol 'OrtGetApiBase': dlsym(RTLD_DEFAULT, OrtGetApiBase): symbol not found
#0 DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:33)
#1 OnnxRuntimeBindings._OrtGetApiBasePtr (package:onnxruntime/src/bindings/onnxruntime_bindings_generated.dart:38)
#2 OnnxRuntimeBindings.OrtGetApiBase (package:onnxruntime/src/bindings/onnxruntime_bindings_generated.dart)
#3 OnnxRuntimeBindings.OrtGetApiBase (package:onnxruntime/src/bindings/onnxruntime_bindings_generated.dart)
#4 new OrtEnv.
(package:onnxruntime/src/ort_env.dart:22)
#5 OrtEnv._instance (package:onnxruntime/src/ort_env.dart:11)
#6 inferSingleSequence (package:equifib_2/utils/onnx_runtime.dart)
#7 _EcgScreenState.onDisconnectPressed (package:equifib_2/screens/ecg_screen.dart:412)

using plugin version 1.4.1, flutter 3.19.3, Xcode 15.4, target iOS 13.

Not 100% sure if this is purely a bug of the onnxruntime plugin, but other cocoa pods dependent plugins don't have any problems.
When looking at the linked frameworks in the IPA file I don't see the onnxruntime framework listed, but I'm not sure if this is normal or not?

@gtbluesky
Copy link
Owner

Try to set STRIP_STYLE = "non-global" in YourPorject.xcodeproj/project.pbxproj

@smilingjack10
Copy link
Author

Hi,
Thank you for the quick response!
Unfortunately, setting STRIP_STYLE="non-global" in the runner or pods Xcode project didn't help.
However, adding STRIP_INSTALLED_PRODUCT = NO; under the build settings of the release version did. Thank you for pointing me in the right direction!
I changed this in: ios/Runner.xcodeproj/project.pbxproj

@Cyberbolt
Copy link

For profile and release modes, I added _OrtGetApiBase to ios/Runner/libs/symbols.list (if there is no such file, please create it yourself), and then added -Xlinker, -exported_symbols_list, -Xlinker, $(SRCROOT)/Runner/libs/symbols.list to Profie and Release in Build Settings - Other linker Flags to expose the _OrtGetApiBase function in the static library to Flutter.

@gdaegeun539
Copy link

gdaegeun539 commented Oct 17, 2024

Hi, Thank you for the quick response! Unfortunately, setting STRIP_STYLE="non-global" in the runner or pods Xcode project didn't help. However, adding STRIP_INSTALLED_PRODUCT = NO; under the build settings of the release version did. Thank you for pointing me in the right direction! I changed this in: ios/Runner.xcodeproj/project.pbxproj

This one and previous comment worked from me. Thanks for your comments.

If you(viewer) want to edit this at the Xcode directly, follow these steps...

Xcode -> Runner.xcodeproj -> "Targets-Runner" -> Build Settings Tab -> Deployment category -> at Runner
"Strip Linked Product" to set "No"
"Strip Style" to set "Non-Global-Symbols"

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

4 participants