bytecodealliance / ComponentizeJS

JS -> WebAssembly Component
Apache License 2.0
242 stars 32 forks source link

Not able to run the example with Rust #8

Closed raymundovr closed 1 year ago

raymundovr commented 1 year ago

Hi,

I've successfully executed the example with node, now I'm trying to run it with Rust, however I'm getting the following

error: failed to select a version for `wasmtime-fiber`.
    ... required by package `wasmtime v6.0.0`
    ... which satisfies dependency `wasmtime = "^6.0.0"` of package `host v0.0.0 (https://github.com/bytecodealliance/preview2-prototyping#75f8fc61)`
    ... which satisfies git dependency `host` of package `runner v0.1.0 (/Users/r/Experimentos/componentize/runner)`
versions that meet the requirements `=6.0.0` are: 6.0.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 v6.0.0 (https://github.com/bytecodealliance/wasmtime?branch=release-6.0.0#c00d3f05)`
    ... which satisfies git dependency `wasmtime-fiber` of package `wasmtime v6.0.0 (https://github.com/bytecodealliance/wasmtime?branch=release-6.0.0#c00d3f05)`
    ... which satisfies git dependency `wasmtime` of package `runner v0.1.0 (/Users/r/Experimentos/componentize/runner)`
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 yo
ur dependencies so that only one package uses the links ='wasmtime-fiber' value.
failed to select a version for `wasmtime-fiber` which could resolve this conflict

Where runner is my local project.

I've been checking the repos and seen that preview2-prototyping has only one tag, how would you suggest to resolve this?

Thank you!

guybedford commented 1 year ago

You may need to update to the Rust nightly toolchain I believe? This definitely sounds like Rust toolchain setup to me.

raymundovr commented 1 year ago

Hi @guybedford,

I've just updated my nightly toolchain and the error persists

❯ rustup show
Default host: aarch64-apple-darwin
rustup home:  /Users/r/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin (default)
nightly-aarch64-apple-darwin
nightly-x86_64-apple-darwin

active toolchain
----------------

nightly-aarch64-apple-darwin (directory override for '/Users/r/Experimentos/componentize/runner')
rustc 1.69.0-nightly (44cfafe2f 2023-03-03)
guybedford commented 1 year ago

Perhaps you need to make the nightly toolchain the default as it is applying to dependency builds, I'm not sure.

Also make sure you have the wasm32-unknown-unknown and wasm32-wasi targets installed as well.

jianghong commented 1 year ago

I was able to get past this issue by using the exact same wasmtime version as specified by the host crate here

guybedford commented 1 year ago

I'll make sure to include the revision in the next toolchain upgrade PR.

raymundovr commented 1 year ago

Thanks @guybedford. I did follow @jianghong advice, however I ran into another error. I'll just wait for those revisions.

guybedford commented 1 year ago

Sure, the next update is just waiting on some WASI adapter work, will hopefully be able to update later this week.

guybedford commented 1 year ago

The latest release now includes the revision. Please just let me know if you have any further issues here.