I am trying to get lox-wasm running to contribute to the Tor Project.
I followed the README.md and executed wasm-pack build --target web but I get the following errors:
rror: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
--> /Users/niel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.16/src/lib.rs:346:9
|
346 | / compile_error!("the wasm*-unknown-unknown targets are not supported by \
347 | | default, you may need to enable the \"js\" feature. \
348 | | For more information see: \
349 | | https://docs.rs/getrandom/#webassembly-support");
| |________________________________________________________________________^
Compiling wasm-bindgen v0.2.100
error[E0433]: failed to resolve: use of undeclared crate or module `imp`
--> /Users/niel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/getrandom-0.2.16/src/lib.rs:402:9
|
402 | imp::getrandom_inner(dest)?;
| ^^^ use of undeclared crate or module `imp`
For more information about this error, try `rustc --explain E0433`.
error: could not compile `getrandom` (lib) due to 2 previous errors
But wasm_js is set for get_random in the Cargo.toml.
It compiles with cargo build --lib --release but that of course does not generate the correct WASM files IG.
@nerditation Hmmm, changing my Cargo.toml with this: getrandom = { version = "0.2", features = ["js"] } instead of getrandom = { version = "0.3.0", features = ["wasm_js"] } seems to compile
so the dependency on getrandom@0.2 mostly is traced back to the one of the lox-xxx crates. unless you need the new features from 0.3, it is good practice to stick with the same 0.2 version.
when you change the direct dependency from 0.3 to 0.2, cargo will be able to unify the features since they fall in the same semver number.