You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A project i'm trying to build fails with All entropy sources failed (permanently unavailable); cause: OsRng: support for wasm32 requires emscripten, stdweb or wasm-bindgen (permanently unavailable), though getrandom says it supports __wasi_random_get
Looks like you are not building for WASI target (note: WASM is like CPU architecture and WASI is in a certain sense an operating system, so the first does not necessarily imply the second). Depending on that you use, enable stdweb or wasm-bindgen feature for getrandom crate. You can do it be adding this line to your project's Cargo.toml dependencies section:
getrandom = { version = "*", features = ["wasm-bindgen"] }
Hm, this is strange... I can't find from where this error comes. Search does not show any code in this and rand repository which produces it. What versions of getrandom/rand do you use? Have you tried to use getrandom directly?
Note that getrandom is used only since rand v0.7 and rand_os v0.2, and IIRC earlier versions of those crates did not support WASI.
Activity
newpavlov commentedon Jun 14, 2019
Looks like you are not building for WASI target (note: WASM is like CPU architecture and WASI is in a certain sense an operating system, so the first does not necessarily imply the second). Depending on that you use, enable
stdweborwasm-bindgenfeature forgetrandomcrate. You can do it be adding this line to your project'sCargo.tomldependencies section:devsnek commentedon Jun 14, 2019
i'm doing
cargo build --target wasm32-unknown-wasi. (and I'm aware what WASI is to WASM)dhardy commentedon Jun 14, 2019
As I said in the other issue, use the target
wasm32-wasi(check the changelog).devsnek commentedon Jun 14, 2019
updating to rustc beta and using
wasm32-wasiproduces the same error.newpavlov commentedon Jun 14, 2019
Hm, this is strange... I can't find from where this error comes. Search does not show any code in this and
randrepository which produces it. What versions ofgetrandom/randdo you use? Have you tried to usegetrandomdirectly?Note that
getrandomis used only sincerand v0.7andrand_os v0.2, and IIRC earlier versions of those crates did not support WASI.devsnek commentedon Jun 14, 2019
using
rand 0.7.0-pre.1worked.