chemicstry / wasm_thread

A rust `std::thread` replacement for wasm32 target
Apache License 2.0
123 stars 16 forks source link

Multiple issues trying to run the example #4

Closed willmcpherson2 closed 2 years ago

willmcpherson2 commented 3 years ago

In trying to run the example I encountered multiple issues.

  1. Recent versions of the nightly compiler won't work due to link issues. See this issue. You can fix this by using a slightly older compiler, e.g. nightly-2021-03-01.
  2. Using build_wasm.sh is very confusing because it invokes wasm-bindgen. Installing wasm-bindgen is confusing and not even recommended according to the wasm-bindgen guide. build_wasm.sh should instead use wasm-pack.
  3. The example would be much more useful if it was a standalone directory with its own Cargo.toml, lib.rs, build_wasm.sh, index.html, etc. Running cargo run --example simple is fine but as soon as I want to actually use wasm_thread in my own project I suddenly have to figure out what I need in my Cargo.toml, which .js files I need, where to put my .html file, etc.

So essentially my proposal is to (1) switch to an older compiler version, (2) switch to wasm-pack and (3) create a standalone example that can easily be extracted and built without locally linking to wasm_thread.

chemicstry commented 2 years ago

Sorry for the late response (lost the notification).

I was about to fix issues that you mentioned, but it seems that this library is made kind of obsolete with https://github.com/GoogleChromeLabs/wasm-bindgen-rayon, which has active development and better documentation.

willmcpherson2 commented 2 years ago

@chemicstry Thanks. Looks like we'll get multithreaded Rust in the browser soon enough.