bytecodealliance / cargo-wasi

A lightweight Cargo subcommand to build Rust code for the `wasm32-wasi` target
https://bytecodealliance.github.io/cargo-wasi/
Apache License 2.0
444 stars 29 forks source link

Unable to compile. #68

Closed MTRNord closed 4 years ago

MTRNord commented 4 years ago

Hi I have a web app (yew based) which uses wasm-bindgen. cargo wasi check returns no errors and the build itself seems to work. However the wasm-bindgen-cli thingy fails with this error:

error: failed to generate a standard interface types section

Caused by:
    0: in adapter function
    1: import of wasm-bindgen specific intrinsic `__wbindgen_string_new` requires JS glue
error: failed to process wasm at `C:\Users\mtrnord\IdeaProjects\Daydream\target\wasm32-wasi\release\daydream_app.rustc.wasm`

Caused by:
    failed to execute "C:\\Users\\mtrnord\\AppData\\Local\\cargo-wasi\\0.1.22\\wasm-bindgen\\0.2.67\\wasm-bindgen.exe" "C:\\Users\\mtrnord\\IdeaProjects\\Daydream\\target\\wasm32-wasi\\release\\daydream_app.rustc.wasm" "--out-dir" "C:\\Users\\mtrnord\\IdeaProjects\\Daydream\\target\\wasm32-wasi\\release\\.tmpc3QP8R" "--out-name" "foo"
        status: exit code: 1
[cargo-make] ERROR - Error while executing command, exit code: 1

Any hint on why this happens or how I can fix this issue? I ran cargo wasi build --release --bin daydream_app to get to this issue

alexcrichton commented 4 years ago

Thanks for the report! The purpose of cargo wasi build right now is for a preview of the interface types proposa, which doesn't support all of JsValue right now unfortunately. This is an expected error for now, but if you're building for the web you may want to use wasm-pack instead.

MTRNord commented 4 years ago

Thanks yeah I figured it would work with web as https://github.com/dunnock/wasi-worker exists but it seems wasi only works in the service-worker scope. Not in the UI scope :)