bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
15.31k stars 1.29k forks source link

Compatibility of wasmtime with yew #6983

Closed amiyatulu closed 1 year ago

amiyatulu commented 1 year ago

Wasmtime doesn't work in yew

It gives error:

error: failed to run custom build command for `cranelift-codegen v0.99.1`

Caused by:
  process didn't exit successfully: `/home/amiya/Documents/workspace/mastodon/mastolearn/target/debug/build/cranelift-codegen-e40b7bea58046d12/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'error when identifying target: "no supported isa found for arch `wasm32`"', /home/amiya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.99.1/build.rs:45:53
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error[E0583]: file not found for module `sys`
  --> /home/amiya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/errno-0.3.3/src/lib.rs:26:1
   |
26 | mod sys;
   | ^^^^^^^^
   |
   = help: to create the module `sys`, create file "/home/amiya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/errno-0.3.3/src/sys.rs" or "/home/amiya/.cargo/registry/src/index.crates.io-6f17d22bba15001f/errno-0.3.3/src/sys/mod.rs"
bjorn3 commented 1 year ago

Wasmtime can't be compiled to webassembly. You will have to use eg the web-sys crate to interface with the native wasm support of browsers if you are running the wasm module in the browser. See also https://github.com/bytecodealliance/wasmtime/issues/6504

amiyatulu commented 1 year ago

Ok got it. Thanks.