The ONNX runtime
Model inference needs the ONNX Runtime shared library. Phasic loads it from beside its own
executable rather than from a system installation, so a packaged build is self-contained:
no system install, no pip, no environment variable.
This page applies only to a build with the onnx feature, which is off by default. A
plain cargo run contains no inference and never looks for the runtime.
Whether you have to do anything depends on the platform.
Linux — once
./runtime/fetch.sh # matching runtime for this OS and architecture
ORT_VERSION=1.24.0 ./runtime/fetch.sh # or pin a specific version
Linux needs this step because the ort crate’s prebuilt binary targets glibc 2.38 or
newer; on an older system it fails to link. Phasic therefore loads the library
dynamically and supplies its own — fetch.sh downloads Microsoft’s official manylinux
build, whose older glibc baseline runs on any modern distribution.
Loading dynamically also disables the crate’s build-time download, which is why this step is manual on Linux and nowhere else.
Windows and macOS — nothing
The runtime is downloaded during cargo build and copied next to the executable, which is
the first place Phasic looks. The first build with the onnx feature needs network access.
Without the runtime
Phasic starts and runs normally. Everything except model inference works. Loading a model fails immediately with an error naming every location that was searched:
ONNX Runtime (libonnxruntime.so) not found, so no model can be loaded. Looked in:
…/target/release/libonnxruntime.so
…/target/release/runtime/libonnxruntime.so
…/target/release/lib/libonnxruntime.so
…/target/lib/libonnxruntime.so
…/runtime/libonnxruntime.so
Install it once with `./runtime/fetch.sh`, or point ORT_DYLIB_PATH at a copy.
How Phasic finds it
In order:
ORT_DYLIB_PATH, if set and the file exists — an explicit override for a custom install- Beside the executable:
<exe>/,<exe>/runtime/,<exe>/lib/,<exe>/../lib/— the layouts a packaged application uses - The
runtime/directory under the application root, so a source checkout works afterfetch.sh
Because the search is relative to the binary, the same build works on any machine with nothing for the user to install.
Version
The runtime must match the version the ort crate wraps — currently ONNX Runtime 1.24.
A mismatch fails to load with an API-version error.
Packaging
A distributable build must place the platform’s runtime beside the application binary, or in one of the bundle layouts above:
| Platform | Placement |
|---|---|
| Linux | libonnxruntime.so beside the binary, or in an AppImage usr/lib |
| Windows | onnxruntime.dll next to the .exe |
| macOS | libonnxruntime.dylib in the bundle’s Contents/Frameworks, or beside the binary |
The library files are large and are not committed to the repository.