Skip to content

fix(nix): fix build with ort-sys 2.0.0-rc.12#1057

Closed
xilec wants to merge 2 commits intocjpais:whisper-rs-0.16.0from
xilec:fix/nix-ort-rc12
Closed

fix(nix): fix build with ort-sys 2.0.0-rc.12#1057
xilec wants to merge 2 commits intocjpais:whisper-rs-0.16.0from
xilec:fix/nix-ort-rc12

Conversation

@xilec
Copy link
Copy Markdown
Contributor

@xilec xilec commented Mar 16, 2026

Summary

Fixes the Nix build broken by the migration to ort-sys 2.0.0-rc.12 (commit b85cc03).

Two issues:

  1. Linking failureort-sys rc.12 removed pkg-config support, so with ORT_LIB_LOCATION set it defaults to static linking. nixpkgs only provides shared .so libraries → build fails. Fixed by setting ORT_PREFER_DYNAMIC_LINK=1 (same as already done in build.yml for macOS).

  2. Runtime crashort rc.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 .#handy completes successfully
  • Parakeet model loads and transcribes without API version errors
  • Whisper turbo model loads and transcribes via Vulkan

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).
@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Mar 16, 2026

@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
@xilec xilec force-pushed the fix/nix-ort-rc12 branch from 8b6dba4 to c7dba01 Compare March 16, 2026 11:00
@xilec
Copy link
Copy Markdown
Contributor Author

xilec commented Mar 16, 2026

@cjpais Good point! I've updated the PR — the overlay now uses Microsoft's official prebuilt binaries from GitHub Releases (onnxruntime-linux-x64-1.24.2.tgz / onnxruntime-linux-aarch64-1.24.2.tgz), patched with autoPatchelfHook for NixOS compatibility.

Tested locally — both Parakeet and Whisper turbo load and transcribe successfully with the prebuilt binaries.

@xilec
Copy link
Copy Markdown
Contributor Author

xilec commented Mar 16, 2026

The fixes from this PR were included in PR #1041

@xilec xilec closed this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants