fix(nix): fix build with ort-sys 2.0.0-rc.12#1057
fix(nix): fix build with ort-sys 2.0.0-rc.12#1057xilec wants to merge 2 commits intocjpais:whisper-rs-0.16.0from
Conversation
ort-sys rc.12 removed pkg-config support; without ORT_PREFER_DYNAMIC_LINK it defaults to static linking against ORT_LIB_LOCATION, which fails because nixpkgs only provides shared libraries (.so).
|
@xilec overall this makes sense to me, curious though, would it be worth pre-compiling the binary to keep CI relatively fast? Right now I have pre-compiled onnx for ubuntu-22.04 and also It's possible we can also use the MS official distributions if they work for nix? https://github.com/microsoft/onnxruntime/releases/tag/v1.24.2 |
ort 2.0.0-rc.12 enables API v24 by default, but nixpkgs only ships onnxruntime 1.23.2 (API v23), causing a runtime panic on model load. Use Microsoft's prebuilt binaries for onnxruntime 1.24.2 via overlay, patched with autoPatchelfHook for NixOS compatibility. This overlay should be removed once nixpkgs merges onnxruntime ≥ 1.24: NixOS/nixpkgs#499389
|
@cjpais Good point! I've updated the PR — the overlay now uses Microsoft's official prebuilt binaries from GitHub Releases ( Tested locally — both Parakeet and Whisper turbo load and transcribe successfully with the prebuilt binaries. |
|
The fixes from this PR were included in PR #1041 |
Summary
Fixes the Nix build broken by the migration to
ort-sys 2.0.0-rc.12(commit b85cc03).Two issues:
Linking failure —
ort-sysrc.12 removedpkg-configsupport, so withORT_LIB_LOCATIONset it defaults to static linking. nixpkgs only provides shared.solibraries → build fails. Fixed by settingORT_PREFER_DYNAMIC_LINK=1(same as already done inbuild.ymlfor macOS).Runtime crash —
ortrc.12 enables API v24 by default, but nixpkgs ships onnxruntime 1.23.2 (API v23). The binary builds but panics at runtime:The requested API version [24] is not available. Fixed by overriding onnxruntime with Microsoft's prebuilt 1.24.2 binaries via a Nix overlay +autoPatchelfHook.The overlay is temporary — once NixOS/nixpkgs#499389 (onnxruntime 1.23.2 → 1.24.3) is merged, it can be removed.
Test plan
nix build .#handycompletes successfully