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

The incorrect search path #152

Closed
rustui opened this issue Feb 3, 2024 · 6 comments · Fixed by #153
Closed

The incorrect search path #152

rustui opened this issue Feb 3, 2024 · 6 comments · Fixed by #153
Labels
bug Something isn't working help wanted Extra attention is needed os: android p: med medium priority

Comments

@rustui
Copy link
Contributor

rustui commented Feb 3, 2024

I want to statically link onnxruntime for Android compilation on the Mac platform with ort, but I encountered an error saying:
"could not find native static library onnx"
I discovered that ort is searching for the path Android/_deps/onnx-build/Release, whereas onnx is actually located at Android/Release/_deps/onnx-build.

@rustui
Copy link
Contributor Author

rustui commented Feb 3, 2024

After I temporarily modified build.rs locally, it now reports an error that it cannot find re2. Indeed, I also cannot find libre2.a under the entire Android folder locally.

@decahedron1 decahedron1 added bug Something isn't working p: med medium priority os: android labels Feb 3, 2024
@decahedron1
Copy link
Member

Can you run git rev-parse HEAD in the onnxruntime repo you checked out? This should've been fixed by #121 but I wonder if the dependencies/build process has changed since then.

@rustui
Copy link
Contributor Author

rustui commented Feb 3, 2024

The hash value is 2ac381c55397dffff327cc6efecf6f95a70f90a1

@decahedron1 decahedron1 added the help wanted Extra attention is needed label Feb 3, 2024
@rustui
Copy link
Contributor Author

rustui commented Feb 3, 2024

Can ort be configured to neither statically link to onnxruntime nor dynamically link to onnxruntime? I want to call Rust code that uses ort in a Flutter project, and I can configure the Flutter project to dynamically link to onnxruntime.
Sorry for asking a somewhat unrelated question.

@decahedron1
Copy link
Member

The question confuses me, but I think you might want the load-dynamic feature: https://ort.pyke.io/setup/linking#load-dynamic-a-glimmer-of-hope

@decahedron1 decahedron1 linked a pull request Feb 3, 2024 that will close this issue
@rustui
Copy link
Contributor Author

rustui commented Feb 3, 2024

Thank you for your reply. I found that I must first compile onnxruntime into a dynamic library (by adding the parameter --build_shared_lib) to avoid missing re2. After modifying build.rs, now ort can successfully statically link onnxruntime and run on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed os: android p: med medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants