fix(hero_embedderd): make Path import unconditional — Linux build was broken #32

Closed
mik-tf wants to merge 1 commit from development_mik_path_import_linux into development
Owner

Problem

hero_embedderd doesn't compile on Linux on development:

error[E0433]: failed to resolve: use of undeclared type `Path`
   --> crates/hero_embedderd/src/main.rs:235:16
    |
235 |             if Path::new(path).exists() {
    |                ^^^^ use of undeclared type `Path`
    |
note: found an item that was configured out
   --> crates/hero_embedderd/src/main.rs:26:16
    |
 25 | #[cfg(target_os = "macos")]
    |       ------------------- the item is gated behind the `macos` feature
 26 | use std::path::Path;
    |                ^^^^

Cause

Commit 50aa675 (chore: upgrade ONNX Runtime to 1.25.x and improve health checks) refactored the ORT dylib path-detection block to handle both macOS .dylib and Linux .so paths, by removing the #[cfg(target_os = "macos")] from the surrounding if env::var("ORT_DYLIB_PATH").is_err() { ... } block. The change at line 226-244 is correct.

But the matching #[cfg(target_os = "macos")] on the use std::path::Path; import at line 25 was left in place. On macOS the file builds because both the import and the use site are in scope; on Linux the use site is now active but the import is excluded → E0433.

Fix

Remove the #[cfg(target_os = "macos")] attribute from the use std::path::Path; line. The import is now unconditional, matching the use site.

Verification

cargo check -p hero_embedderd --release --bin hero_embedderd on Linux:

   Checking hero_embedderd v0.5.0 (.../hero_embedder/crates/hero_embedderd)
    Finished `release` profile [optimized] target(s) in 1.24s

macOS unaffected — the import was already valid on macOS, and an unconditional import is a strict superset.

## Problem `hero_embedderd` doesn't compile on Linux on `development`: ``` error[E0433]: failed to resolve: use of undeclared type `Path` --> crates/hero_embedderd/src/main.rs:235:16 | 235 | if Path::new(path).exists() { | ^^^^ use of undeclared type `Path` | note: found an item that was configured out --> crates/hero_embedderd/src/main.rs:26:16 | 25 | #[cfg(target_os = "macos")] | ------------------- the item is gated behind the `macos` feature 26 | use std::path::Path; | ^^^^ ``` ## Cause Commit `50aa675` (`chore: upgrade ONNX Runtime to 1.25.x and improve health checks`) refactored the ORT dylib path-detection block to handle both macOS `.dylib` and Linux `.so` paths, by removing the `#[cfg(target_os = "macos")]` from the surrounding `if env::var("ORT_DYLIB_PATH").is_err() { ... }` block. The change at line 226-244 is correct. But the matching `#[cfg(target_os = "macos")]` on the `use std::path::Path;` import at line 25 was left in place. On macOS the file builds because both the import and the use site are in scope; on Linux the use site is now active but the import is excluded → E0433. ## Fix Remove the `#[cfg(target_os = "macos")]` attribute from the `use std::path::Path;` line. The import is now unconditional, matching the use site. ## Verification `cargo check -p hero_embedderd --release --bin hero_embedderd` on Linux: ``` Checking hero_embedderd v0.5.0 (.../hero_embedder/crates/hero_embedderd) Finished `release` profile [optimized] target(s) in 1.24s ``` macOS unaffected — the import was already valid on macOS, and an unconditional import is a strict superset.
fix(hero_embedderd): make Path import unconditional after ONNX path-detection refactor
Some checks failed
Test / test (pull_request) Failing after 1m47s
39acbb61cb
Commit 50aa675 ("chore: upgrade ONNX Runtime to 1.25.x and improve
health checks") removed the `#[cfg(target_os = "macos")]` gate from
the ORT dylib detection block so it could find Linux `.so` files as
well as macOS `.dylib` files, but left the matching gate on the
`use std::path::Path;` import. On macOS both the import and the use
are in scope and the file builds; on Linux the use site is active
but the import is excluded, producing:

    error[E0433]: failed to resolve: use of undeclared type `Path`
       --> crates/hero_embedderd/src/main.rs:235:16

Drop the cfg from the import — it now matches the unconditional use
site. macOS unaffected.
Author
Owner

Superseded by #34 (merged via 185cbc1) — same one-line fix landed independently. Closing.

Superseded by #34 (merged via 185cbc1) — same one-line fix landed independently. Closing.
mik-tf closed this pull request 2026-05-03 16:27:51 +00:00
Some checks failed
Test / test (pull_request) Failing after 1m47s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_embedder!32
No description provided.