Skip to content

[Question]: Linking onnxruntime, shared library hell on MacOs #388

Closed
@rdcm

Description

@rdcm

Hi,

Right now I'm working on porting a Python service that uses silero-vad and sherpa-onnx to Rust. For model inference in the Rust version of the application, I’m using:

Example of how the libraries are included:

sherpa-rs = { version = "0.6.6", features = ["sys", "download-binaries" ] }
ort = { version = "=2.0.0-rc.9", features = ["ndarray", "cuda", "load-dynamic", "download-binaries"] }

At the moment, I’ve run into an issue that could be described as “shared library hell,” as mentioned in the documentation:

  1. sherpa-rs copies its own version of libonnxruntime.dylib (version 1.17) into target/debug.

  2. ort apparently detects that libonnxruntime.dylib is already loaded and doesn’t try to load its own.

  3. At runtime, when I call the ort API, I get the error: "The requested API version [20] is not available, only API versions [1, 17] are supported in this build".

This brings me to a couple of questions:

  1. Where does ort get libonnxruntime.dylib from, and why doesn’t it appear in target/debug even when I’m only using ort?
    My current hypothesis is that ort looks it up from somewhere in the cache:
    /Library/Caches/ort.pyke.io/dfbin/x86_64-apple-darwin/{hash}/onnxruntime/lib/libonnxruntime.a.

  2. What is the recommended way to configure ort in my case?
    So far, it seems like I need to manually download a matching ONNX Runtime distribution and specify its path using ORT_DYLIB_PATH.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions