wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

is there a version compatible with wasmtime `main` branch?

Open yamt opened this issue 1 year ago • 2 comments

i want to adapt https://github.com/bytecodealliance/wasmtime/tree/main/crates/wasi-nn to the wit version of the spec.

if i add the following to the dependencies in Cargo.toml,

wit-bindgen-wasmtime = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "0e30d8c6e9dcad80bb033a0ae5fbfe9827822e28" }

it ends up with the following error.

    Updating git repository `https://github.com/bytecodealliance/wit-bindgen`
    Updating crates.io index
error: failed to select a version for `wasmtime-fiber`.
    ... required by package `wasmtime v0.38.0`
    ... which satisfies dependency `wasmtime = "^0.38.0"` of package `wit-bindgen-wasmtime v0.1.0 (https://github.com/bytecodealliance/wit-bindgen?rev=0e30d8c6e9dcad80bb033a0ae5fbfe9827822e28#0e30d8c6)`
    ... which satisfies git dependency `wit-bindgen-wasmtime` of package `wasmtime-wasi-nn v0.40.0 (/private/tmp/wasmtime/crates/wasi-nn)`
    ... which satisfies path dependency `wasmtime-wasi-nn` (locked to 0.40.0) of package `wasmtime-bench-api v0.19.0 (/private/tmp/wasmtime/crates/bench-api)`
versions that meet the requirements `=0.38.0` are: 0.38.0

the package `wasmtime-fiber` links to the native library `wasmtime-fiber-shims`, but it conflicts with a previous package which links to `wasmtime-fiber-shims` as well:
package `wasmtime-fiber v0.40.0 (/private/tmp/wasmtime/crates/fiber)`
    ... which satisfies path dependency `wasmtime-fiber` (locked to 0.40.0) of package `wasmtime v0.40.0 (/private/tmp/wasmtime/crates/wasmtime)`
    ... which satisfies path dependency `wasmtime` (locked to 0.40.0) of package `test-programs v0.19.0 (/private/tmp/wasmtime/crates/test-programs)`
    ... which satisfies path dependency `test-programs` (locked to 0.19.0) of package `wasmtime-cli v0.40.0 (/private/tmp/wasmtime)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='wasmtime-fiber' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

failed to select a version for `wasmtime-fiber` which could resolve this conflict

to me it seems basically saying wasmtime and wit-bindgen version need to be lock-step. is it right? is there any workaround? (sorry for a dumb question, i suspect i'm missing something obvious as i'm a rust-beginner.)

yamt avatar Jul 20 '22 03:07 yamt

This library isn't really ready for inclusion in Wasmtime yet. Work would need to be done to allow the wasmtime dependency itself to have a different version to enable that. It's probably too early to update wasi-nn yet.

alexcrichton avatar Jul 20 '22 14:07 alexcrichton

This library isn't really ready for inclusion in Wasmtime yet. Work would need to be done to allow the wasmtime dependency itself to have a different version to enable that. It's probably too early to update wasi-nn yet.

ok. thank you for explanation.

yamt avatar Jul 21 '22 03:07 yamt

I'm going to close this since we'll be working towards this in the near future but otherwise this isn't ready yet as-is for use with the wasmtime crate.

alexcrichton avatar Sep 01 '22 19:09 alexcrichton