Closed sainteckes closed 2 months ago
I believe this is just a side effect of how staticlib
s are produced, since they don't include code from dependencies. The only way around this is to either link to libonnxruntime
manually or build with the lib
crate-type.
Okay thank you, but when I download the libs myself from the location of the ort-sys/dist.txt
and set the env-variable ORT_LIB_LOCATION=<onnxruntime/lib> cargo build --release
, the library will be included in the .a and the C project works! I just have to redownload them, as you are deleting the downloaded libs after the build?
I'm not sure I understand, ort
shouldn't be deleting anything. Is the library in onnxruntime/lib
being automatically deleted after each build?
Maybe I am just not finding the ones that are automatically downloaded. Should they not be in the target folder?
The automatically downloaded libraries are located in ~/.cache/ort.pyke.io/dfbin
on Linux, ~/Library/Caches/ort.pyke.io/dfbin
on macOS, and %LOCALAPPDATA%\ort.pyke.io\dfbin
on Windows.
Got it, thank you!! :)
But why is there a difference when I build with ORT_LIB_LOCATION=~/.cache/ort.pyke.io/dfbin/x86_64-unknown-linux-gnu/6FAF334246A635808FCDAC6D5550C4D56814B1E92CCA5FC0642AF41437BF071F/onnxruntime/lib cargo build --release
or without? The version above now works in the C project as well.
Hey @decahedron1, I think I fixed the issue with this Pull Request. Let me know with a review if it is ok.
Hey! The project is really great and using the static libs by default makes it so much nicer to use onnx runtime!
I wanted to give one of our models to a client that needs a C-Interface. I can create a static (.a) library out of the project with
crate-type = ["staticlib"]
. When trying to build a C++ project linking to this library it does not find the references to ort functions. So it seems like the static library does not get re-exported into the .a file. I know that I can link in the C++ project again to the static library, but do you know of a solution how rust can export the library into the .a?Platform: Linux 6.9.5-arch1-1, x86_64 ORT-version: ort = { version = "2.0.0-rc.2", features = ["ndarray", "download-binaries"] }
Best, Stephan