Skip to content

fix(build): use WASM backend for onnxruntime in compiled binary#39

Merged
sarath-soman merged 1 commit intomainfrom
fix/issue38-missing-libonnxruntime-dylib
Mar 8, 2026
Merged

fix(build): use WASM backend for onnxruntime in compiled binary#39
sarath-soman merged 1 commit intomainfrom
fix/issue38-missing-libonnxruntime-dylib

Conversation

@sarath-soman
Copy link
Contributor

Summary

  • Switch compiled binary from onnxruntime-node (native) to onnxruntime-web (WASM) backend to eliminate missing libonnxruntime.1.21.0.dylib dependency
  • Build script stubs onnxruntime-nodeonnxruntime-web re-export during compilation, restores afterward
  • WASM runtime files downloaded once from CDN on first run, cached at ~/.cache/pramana/wasm/
  • Add onnxruntime-common as direct dependency to fix Bun package resolution
  • Tighten smoke test: assert no dlopen/libonnxruntime errors in stderr

Test plan

  • bun run lint passes
  • bun run typecheck passes
  • bun test test/unit/ test/e2e/ — 297 tests pass
  • bun test test/precommit/ — 64 tests pass
  • Compiled binary: ./pramana search "purchase" --source test/fixtures --standalone returns semantic search results (4 results with RRF ranking)
  • Compiled binary: ./pramana search "delivery tracking" --source test/fixtures --standalone correctly ranks "Shipping Info" first via semantic similarity
  • No dlopen or libonnxruntime errors in binary stderr
  • Dev mode (bun run) still uses native backend

Closes #38

🤖 Generated with Claude Code

The compiled binary embeds onnxruntime_binding.node but not its transitive
dependency libonnxruntime.1.21.0.dylib, causing semantic search to silently
fall back to FTS-only. Fix by switching to the WASM backend (onnxruntime-web)
at build time:

- Build script stubs onnxruntime-node with onnxruntime-web re-export during
  compilation, then restores the real package afterward
- Embedder configures writable cache dirs (models + WASM runtime) to avoid
  /$bunfs read-only filesystem in compiled binaries
- WASM runtime files are downloaded once from CDN on first run and cached
  in ~/.cache/pramana/wasm/
- Add onnxruntime-common as direct dependency to fix Bun package resolution
- Tighten smoke test to assert no dlopen/libonnxruntime errors

Closes #38

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sarath-soman sarath-soman added the bug Something isn't working label Mar 8, 2026
@sarath-soman sarath-soman merged commit f5fc4e6 into main Mar 8, 2026
6 checks passed
@sarath-soman sarath-soman deleted the fix/issue38-missing-libonnxruntime-dylib branch March 8, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiled binary missing libonnxruntime.1.21.0.dylib — semantic search silently disabled

1 participant