fix: restore Intel Mac build via ort-dynamic + system libonnxruntime

Microsoft is discontinuing x86_64 macOS ONNX Runtime prebuilts after
v1.23.0, so ort-sys 2.0.0-rc.11 can't ship an Intel Mac binary and never
will. Previous Intel Mac attempts kept dying in the ort-sys build script
with "does not provide prebuilt binaries for the target x86_64-apple-darwin
with feature set (no features)." Issue #41 was the latest casualty.

Fix: route Intel Mac through the ort-dynamic feature path (runtime dlopen
against a system libonnxruntime installed via Homebrew). This sidesteps
ort-sys prebuilts entirely and works today.

Changes:

- crates/vestige-core/Cargo.toml: split `embeddings` into code-only vs
  backend-choice. The embeddings feature now just pulls fastembed + hf-hub
  + image-models and activates the 27 #[cfg(feature = "embeddings")] gates
  throughout the crate. New `ort-download` feature carries the
  download-binaries-native-tls backend (the historical default). Existing
  `ort-dynamic` feature now transitively enables `embeddings`, so the
  cfg gates stay active when users swap backends.

  Default feature set expands `["embeddings", ...]` -> `["embeddings",
  "ort-download", ...]` so existing consumers see identical behavior.

- crates/vestige-mcp/Cargo.toml: mirrors the split. Adds `ort-download`
  feature that chains to vestige-core/ort-download, keeps `ort-dynamic`
  that chains to vestige-core/ort-dynamic. Both transitively pull
  `embeddings`. Default adds `ort-download` so `cargo install vestige-mcp`
  still picks the prebuilt-ort backend like before.

- .github/workflows/ci.yml: re-adds x86_64-apple-darwin to the
  release-build matrix with `--no-default-features --features
  ort-dynamic,vector-search`. Adds a `brew install onnxruntime` step that
  sets ORT_DYLIB_PATH from `brew --prefix onnxruntime`.

- .github/workflows/release.yml: re-adds x86_64-apple-darwin to the
  release matrix with the same flags + brew install step. The Intel Mac
  tarball now also bundles docs/INSTALL-INTEL-MAC.md so binary consumers
  get the `brew install onnxruntime` + ORT_DYLIB_PATH prereq out of the
  box.

- docs/INSTALL-INTEL-MAC.md: new install guide covering the Homebrew
  prereq, binary install, source build, troubleshooting, and the v2.1
  ort-candle migration plan.

- README.md: replaces the "Intel Mac and Windows build from source only"
  paragraph with the prebuilt Intel Mac install (brew + curl + env var)
  and a link to the full guide. Platform table updated: Intel Mac back
  on the "prebuilt" list.

Verified locally on aarch64-apple-darwin:
- `cargo check --release -p vestige-mcp` -> clean (default features)
- `cargo check --release -p vestige-mcp --no-default-features
   --features ort-dynamic,vector-search` -> clean

Runtime path on Intel Mac (verified on CI):
  brew install onnxruntime
  export ORT_DYLIB_PATH=$(brew --prefix onnxruntime)/lib/libonnxruntime.dylib
  vestige-mcp --version

Fixes #41. Long-term plan (v2.1): migrate to ort-candle pure-Rust backend
so no system ONNX Runtime dep is needed on any platform.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-04-22 23:02:40 -05:00
parent 30d92b5371
commit 52f1e97e14
6 changed files with 160 additions and 29 deletions

View file

@ -11,29 +11,41 @@ keywords = ["memory", "spaced-repetition", "fsrs", "embeddings", "knowledge-grap
categories = ["science", "database"]
[features]
default = ["embeddings", "vector-search", "bundled-sqlite"]
default = ["embeddings", "ort-download", "vector-search", "bundled-sqlite"]
# SQLite backend (default, unencrypted)
bundled-sqlite = ["rusqlite/bundled"]
# Encrypted SQLite via SQLCipher (mutually exclusive with bundled-sqlite)
# Use: --no-default-features --features encryption,embeddings,vector-search
# Use: --no-default-features --features encryption,embeddings,ort-download,vector-search
# Set VESTIGE_ENCRYPTION_KEY env var to enable encryption
encryption = ["rusqlite/bundled-sqlcipher"]
# Core embeddings with fastembed (ONNX-based, local inference)
# Downloads a pre-built ONNX Runtime binary at build time (requires glibc >= 2.38)
embeddings = ["dep:fastembed", "fastembed/ort-download-binaries-native-tls"]
# Embedding code paths (fastembed dep, hf-hub, image-models). This feature
# enables the #[cfg(feature = "embeddings")] gates throughout the crate but
# does NOT pick an ort backend. Pair with EXACTLY ONE of `ort-download`
# (prebuilt ONNX Runtime, default) or `ort-dynamic` (runtime-linked system
# libonnxruntime, required on targets without prebuilts).
embeddings = ["dep:fastembed", "fastembed/hf-hub-native-tls", "fastembed/image-models"]
# Default ort backend: ort-sys downloads prebuilt ONNX Runtime at build time.
# Requires glibc >= 2.38. Fails on x86_64-apple-darwin (Microsoft is
# discontinuing Intel Mac prebuilts after ONNX Runtime v1.23.0).
ort-download = ["embeddings", "fastembed/ort-download-binaries-native-tls"]
# HNSW vector search with USearch (20x faster than FAISS)
vector-search = ["dep:usearch"]
# Use runtime-loaded ORT instead of the downloaded pre-built binary.
# Required on systems with glibc < 2.38 (Ubuntu 22.04, Debian 12, RHEL/Rocky 9).
# Mutually exclusive with the default `embeddings` feature's download strategy.
# Usage: --no-default-features --features ort-dynamic,vector-search,bundled-sqlite
# Runtime requirement: libonnxruntime.so must be on LD_LIBRARY_PATH or ORT_DYLIB_PATH set.
ort-dynamic = ["dep:fastembed", "fastembed/ort-load-dynamic", "fastembed/hf-hub-native-tls", "fastembed/image-models"]
# Alternative ort backend: runtime-linked against a system libonnxruntime via
# dlopen. Required on Intel Mac and on systems with glibc < 2.38 (Ubuntu
# 22.04, Debian 12, RHEL/Rocky 9). Transitively enables `embeddings` so the
# #[cfg] gates stay active.
#
# Usage: cargo build --no-default-features \
# --features ort-dynamic,vector-search,bundled-sqlite
# Runtime: export ORT_DYLIB_PATH=/path/to/libonnxruntime.{dylib,so}
# (e.g. $(brew --prefix onnxruntime)/lib/libonnxruntime.dylib)
ort-dynamic = ["embeddings", "fastembed/ort-load-dynamic"]
# Nomic Embed Text v2 MoE (475M params, 305M active, Candle backend)
# Requires: fastembed with nomic-v2-moe feature

View file

@ -10,12 +10,17 @@ categories = ["command-line-utilities", "database"]
repository = "https://github.com/samvallad33/vestige"
[features]
default = ["embeddings", "vector-search"]
default = ["embeddings", "ort-download", "vector-search"]
embeddings = ["vestige-core/embeddings"]
vector-search = ["vestige-core/vector-search"]
# For systems with glibc < 2.38 — use runtime-loaded ORT instead of the downloaded pre-built binary.
# Usage: cargo install --path crates/vestige-mcp --no-default-features --features ort-dynamic,vector-search
ort-dynamic = ["vestige-core/ort-dynamic"]
# Default ort backend: downloads prebuilt ONNX Runtime at build time.
# Fails on targets without prebuilts (notably x86_64-apple-darwin).
ort-download = ["embeddings", "vestige-core/ort-download"]
# Alternative ort backend: runtime-linked system libonnxruntime via dlopen.
# Required on Intel Mac and on systems with glibc < 2.38.
# Usage: cargo build --no-default-features --features ort-dynamic,vector-search
# Runtime: export ORT_DYLIB_PATH=$(brew --prefix onnxruntime)/lib/libonnxruntime.dylib
ort-dynamic = ["embeddings", "vestige-core/ort-dynamic"]
[[bin]]
name = "vestige-mcp"