Skip to content

Failed to compile wasmtime-wasi-nn with onnx support #12161

@tamaroning

Description

@tamaroning

Steps to Reproduce

  • cargo new test-lib
  • add the following lines to Cargo.toml
[package]
name = "test-lib-rust"
version = "0.1.0"
edition = "2024"

[dependencies]
wasmtime-wasi-nn = { version = "39.0.0", features = ["onnx-download"] }
  • cargo build

Expected Results

compile.

Actual Results

I got tons of errors.

...
   Compiling wasmtime-internal-wit-bindgen v39.0.1
   Compiling wasmtime-internal-component-macro v39.0.1
   Compiling wasmtime v39.0.1
   Compiling wiggle v39.0.1
   Compiling wasmtime-wasi-nn v39.0.1
error[E0432]: unresolved imports `ort::GraphOptimizationLevel`, `ort::Session`
  --> /home/tamaron/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasmtime-wasi-nn-39.0.1/src/backend/onnx.rs:10:11
   |
10 | use ort::{GraphOptimizationLevel, Session, inputs};
   |           ^^^^^^^^^^^^^^^^^^^^^^  ^^^^^^^
   |           |                       |
   |           |                       no `Session` in the root
   |           |                       help: a similar name exists in the module (notice the capitalization): `session`
   |           no `GraphOptimizationLevel` in the root
   |
   = help: consider importing this enum instead:
           ort::session::builder::GraphOptimizationLevel
   = help: consider importing this struct instead:
           ort::session::Session

error[E0412]: cannot find type `SessionInputValue` in crate `ort`
   --> /home/tamaron/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wasmtime-wasi-nn-39.0.1/src/backend/onnx.rs:180:50
    |
180 |                 let mut session_inputs: Vec<ort::SessionInputValue<'_>> = vec![];
    |                                                  ^^^^^^^^^^^^^^^^^ not found in `ort`
    |
help: consider importing this enum
    |
  3 + use ort::session::SessionInputValue;
    |
help: if you import `SessionInputValue`, refer to it directly
    |
180 -                 let mut session_inputs: Vec<ort::SessionInputValue<'_>> = vec![];
180 +                 let mut session_inputs: Vec<SessionInputValue<'_>> = vec![];
    |
...

Versions and Environment

39.0.0~

Operating system: macOS

Architecture: M2

Extra Info

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixingwasi-nnIssues related to the wasi-nn proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions