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

Can't work with wasm32-wasi target from rustc-2021-01-13

Open passchaos opened this issue 3 years ago • 8 comments

rust version: rustc 1.52.0-nightly (a143517d4 2021-02-16) wasm-bindgen: 0.2.71 wasm-bindgen-cli: 0.2.71

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn greet(_name: &str) {
}

With the above code and cdylib crate-type, I can generate js bindgings on target wasm32-unknown-unknown using wasm-bindgen cli, but not on target wasm32-wasi.

Ths error info when generating binding for wasm32-wasi:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`', $HOME/.cargo/registry/src/***-df7c3c540f42cdbd/wasm-bindgen-cli-support-0.2.71/src/js/binding.rs:165:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Different parameters(--target) of wasm-bindgen cli are tried, and the same error is reported

I checked the difference, the left part of the figure below is wasm32-unknown-unknown target wat info(only contain greet related), the right part is the wasm32-wasi target wat info, It can be seen that the function interface forms generated by the two platforms are different

image

passchaos avatar Feb 28 '21 08:02 passchaos

This is unfortunately due to https://github.com/rust-lang/rust/pull/79998 where wasm-bindgen is no longer compatible with the wasi target.

alexcrichton avatar Mar 01 '21 15:03 alexcrichton

This is unfortunately due to rust-lang/rust#79998 where wasm-bindgen is no longer compatible with the wasi target.

Is there a plan to fix this compatibility problem?

passchaos avatar Mar 01 '21 15:03 passchaos

I do not personally have one, no.

alexcrichton avatar Mar 01 '21 15:03 alexcrichton

@alexcrichton Does https://github.com/rust-lang/rust/pull/83763 not count as a plan to fix the incompatibility?

niklaskorz avatar Jan 15 '22 15:01 niklaskorz

That is thte long-term plan, yes, but it will still take time to get there.

alexcrichton avatar Jan 18 '22 15:01 alexcrichton

That is thte long-term plan, yes, but it will still take time to get there.

@alexcrichton So is there any hope to get wasm-wasi target back in a few month ?

Mohsen7s avatar Jan 20 '22 15:01 Mohsen7s

I do not personally plan on working on it, no.

alexcrichton avatar Jan 20 '22 16:01 alexcrichton

Wondering if there are any new updates on this front. wasm-bindgen is at the heart of a lot of our code and wasi target is very much desirable

rohit-ptl avatar Jun 27 '22 16:06 rohit-ptl

Closing in favor of #2240.

daxpedda avatar May 25 '23 09:05 daxpedda