Wasm-bindgen: Project won't compile with latest nightly release when `atomics+bulk-memory` are set

Created on 8 Jun 2020  路  3Comments  路  Source: rustwasm/wasm-bindgen

Describe the Bug

I just stumbled upon the issue that the wasm-bindgen does not seem to be working with the latest nightly release if you pass rustc compiler flags for threading, e.g. rustflags=["-C", "target-feature=+atomics,+bulk-memory"].

This results in an obscure error that says

wasm-bindgen is currently incompatible with modules that already have a start function

I have found out that using an older nightly version fixes the issue. In my case I had to use nightly-2020-05-15 as new versions always told me that rustfmt for target 'x86_64-apple-darwin' is unavailable.

Steps to Reproduce

  1. Create new project with wasm-pack new test
  2. Run wasm-pack build with RUSTFLAGS='-C target-feature=+atomics,+bulk-memory'

Expected Behavior

I am not sure if this is a bug with the rust compiler itself or if it's an issue with wasm-bindgen, but I'd say that this should work very similar to older nightly versions such as nightly-2020-05-15.

bug

All 3 comments

I think this was fixed very recently in https://github.com/rustwasm/wasm-bindgen/pull/2183, can y'all try that and see if it fixes things?

Heya, I've tried it out and it works (I also ran into the same problem).


Steps to use repository version

  1. Install wasm-bindgen-cli from repository

    git clone [email protected]:rustwasm/wasm-bindgen.git
    cd wasm-bindgen
    cargo install --path crates/cli -Z unstable-options --profile release --force
    
  2. Patch your project to use the local repository copy:

    # Cargo.toml
    [patch.crates-io]
    wasm-bindgen = { path = "/path/to/rustwasm/wasm-bindgen" }
    
  3. Build as normal.

I'm going to close this since I believe it's fixed, but if it's still an issue let me know!

Was this page helpful?
0 / 5 - 0 ratings