pykeio / ort

Fast ML inference & training for Rust with ONNX Runtime

Home Page:https://ort.pyke.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The incorrect search path

rustui opened this issue · comments

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.

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.

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.

The hash value is 2ac381c55397dffff327cc6efecf6f95a70f90a1

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.

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

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.