From b907b92faf247699e4d05ea456322ab4a4f652c7 Mon Sep 17 00:00:00 2001 From: Breadway Date: Fri, 7 Aug 2026 10:51:24 +0800 Subject: [PATCH] bread-onnx: fix workspace test build with load-dynamic dev-dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cargo test --workspace failed to link bread-onnx's own unit tests (undefined symbol OrtGetApiBase) because nothing in this workspace supplies an ort backend — that's deliberately left to each downstream consumer app (breadarr, breadmill, breadpad) in their own repos. None of bread-onnx's unit tests actually open an ONNX session, so enabling ort's load-dynamic feature as a dev-dependency (unifies into this crate's own test builds only, never into downstream consumers) is enough to satisfy the linker without requiring a real onnxruntime. --- Cargo.lock | 11 +++++++++++ bread-onnx/Cargo.toml | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 2bef91d..7bee4f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1337,6 +1337,16 @@ version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +[[package]] +name = "libloading" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" +dependencies = [ + "cfg-if", + "windows-link", +] + [[package]] name = "libredox" version = "0.1.18" @@ -1563,6 +1573,7 @@ version = "2.0.0-rc.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7de3af33d24a745ffb8fab904b13478438d1cd52868e6f17735ef6e1f8bf133" dependencies = [ + "libloading", "ndarray", "ort-sys", "smallvec", diff --git a/bread-onnx/Cargo.toml b/bread-onnx/Cargo.toml index 170bdfc..78769f8 100644 --- a/bread-onnx/Cargo.toml +++ b/bread-onnx/Cargo.toml @@ -32,3 +32,12 @@ anyhow = { workspace = true } [dev-dependencies] tempfile = "3" +# Dev-dependency features unify into this crate's own test/bench builds +# only, never into downstream consumers (they aren't part of the dependency +# graph a consuming app resolves) — so this doesn't compromise the +# consumer-chooses-the-backend policy above. Without it, `cargo test` here +# fails at link time (undefined OrtGetApiBase) because nothing in this +# workspace supplies a backend; none of bread-onnx's own unit tests open a +# real ONNX session, so `load-dynamic` (dlopen at runtime, no static link) +# is enough to satisfy the linker. +ort = { version = "2.0.0-rc.12", default-features = false, features = ["std", "tracing", "load-dynamic", "api-24"] }