Investigate static linking
Dynamic linking of libonnxruntime.so is annoying. If binaries are not run from cargo, they cannot find it (rpath issue). This makes running examples through a debugger difficult.
Static linking might help in that regard. Not sure if upstream supports it though.
Static linking should be possible. I really would like to see this too. I am not sure at all how one would do this though.
The best workaround I found is to copy the dynamic libs into the sysroot/lib folder. Where rust keeps its libs.
I made a build.rs to do it automatically: https://gist.github.com/pYtoner/edf32c2a1f9d298e67c8752757e18eaa
The upstream doesn't recommend static linking against libonnxruntime due to third party dependencies and potentially a debug allocator. https://github.com/microsoft/onnxruntime/issues/8555