Stream: wit-bindgen

Topic: new wit_bindgen_rt undeclared crate error


view this post on Zulip Gareth (Mar 07 2024 at 22:55):

Hi, I wonder if anybody can help. I have a project using wasi-nn onnx that is built via github actions. It uses
wit-bindgen = { version = "0.16.0", default-features = false, features = ["realloc"] }
and has been compiling fine via a gh workflow with no changes to the code base. I am using caching as part of the build action.
Recently I have run the build without the cache and now it will not build with the following compile error relating to bindings:

16450 | pub(crate) use __export_classify_impl as export;
      |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module `wit_bindgen_rt`
     --> src/bindings.rs:16803:5
      |
16803 |     wit_bindgen_rt::maybe_link_cabi_realloc();
      |     ^^^^^^^^^^^^^^ use of undeclared crate or module `wit_bindgen_rt`
      |
help: there is a crate or module with a similar name
      |
16803 |     wit_bindgen::maybe_link_cabi_realloc();
      |     ~~~~~~~~~~~

The reason I have been using an earlier version of wit-bindgen was to utilise this unmerged wasi-nn onnx PR:
https://github.com/bytecodealliance/wasmtime/pull/7691/files#diff-621d8d857c5c84c6449bb6737193b5a3abc47a3e0c4a79a736bfc463570375a7

I am not sure when the error reference to wit_bindgen_rt has appeared as I have not seen this before, I have tried adding wit_bindgen_rt version 0.21.0 to Cargo.toml, however it results in new errors relating to my wit versions:
error: failed to validate exported interface wasi:cli/run@0.2.0-rc-2023-12-05` which are earlier than the currently released version.

Any advice on the best way to go about resolving this would be much appreciated :)

This change adds an ONNXruntime backend for WASI-NN. Since there is only one backend implemented, this will help to move the standardization of this proposal forward. Also, the example usage of the...

view this post on Zulip Alex Crichton (Mar 07 2024 at 23:21):

It seems like you're using cargo component, and you might need to hold back or install an older version of cargo-component perhaps if you want the same build from before to work.

@Peter Huene may know more though.

If you can share a bit more about how to reproduce with a repo or CI log or similar we can help some more too

view this post on Zulip Peter Huene (Mar 07 2024 at 23:24):

@Gareth what version of cargo-component are you using and did it change?

view this post on Zulip Gareth (Mar 08 2024 at 09:56):

Alex Crichton said:

It seems like you're using cargo component, and you might need to hold back or install an older version of cargo-component perhaps if you want the same build from before to work.

Peter Huene may know more though.

If you can share a bit more about how to reproduce with a repo or CI log or similar we can help some more too

Thanks both, I reverted to explicitly using cargo component version 0.8.0 and it built successfully again :)


Last updated: Dec 23 2024 at 12:05 UTC