Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
passchaos opened this issue Feb 28, 2021 · 9 comments
Closed

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

passchaos opened this issue Feb 28, 2021 · 9 comments
Labels

Comments

@passchaos
Copy link

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

@alexcrichton
Copy link
Contributor

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

@passchaos
Copy link
Author

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?

@alexcrichton
Copy link
Contributor

I do not personally have one, no.

@passchaos passchaos changed the title Can't work with wasm32-wasi target Can't work with wasm32-wasi target from rustc-2021-01-13 Mar 4, 2021
@niklaskorz
Copy link

niklaskorz commented Jan 15, 2022

@alexcrichton Does rust-lang/rust#83763 not count as a plan to fix the incompatibility?

@alexcrichton
Copy link
Contributor

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

@Mohsen7s
Copy link

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 ?

@alexcrichton
Copy link
Contributor

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

@rohit-ptl
Copy link

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

@daxpedda
Copy link
Collaborator

Closing in favor of #2240.

@daxpedda daxpedda closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants