0002: Load ONNX Runtime dynamically
Status: Accepted Date: Not recorded in the sourcesContext
Linking ONNX Runtime statically on Windows couples the app to the MSVC STL ABI and causes mismatches (pykeio/ort#361).Decision
Use theort crate with its load-dynamic feature. The app loads onnxruntime.dll, .so or .dylib at runtime through the C API instead of linking it. The runtime is selected by select_ort_runtime() in src-tauri/src/setup/ort_runtime.rs, which sets ORT_DYLIB_PATH before any ORT API is touched.
Consequences
- A runtime library must be present on disk.
scripts/ensure-ort.mjsstages a pinned, SHA-256-verified ONNX Runtime on every platform beforetauri:dev*andtauri:build*, and is the only place the versions and hashes live. See Building from source. - A missing or wrong
ORT_DYLIB_PATHfails quietly: a CPU-only runtime can load and Parakeet takes far longer to preload. Automating the staging replaced hand-editing the path for this reason. - On Windows the bundled
DirectML.dllmust sit next toonnxruntime.dlland be preloaded by absolute path, because the copy in System32 is too old for ORT 1.24 (seeKNOWN_ISSUES.md). - On macOS, the staged dylib is also copied to
src-tauri/macos-frameworks/, whichtauri_buildrequires to exist at compile time. - The pinned
ortversion is2.0.0-rc.12.