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

"All entropy sources failed" on wasm32-wasi #34

Closed
devsnek opened this issue Jun 14, 2019 · 6 comments
Closed

"All entropy sources failed" on wasm32-wasi #34

devsnek opened this issue Jun 14, 2019 · 6 comments

Comments

@devsnek
Copy link

devsnek commented Jun 14, 2019

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

@newpavlov
Copy link
Member

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"] }

@devsnek
Copy link
Author

devsnek commented Jun 14, 2019

i'm doing cargo build --target wasm32-unknown-wasi. (and I'm aware what WASI is to WASM)

@dhardy
Copy link
Member

dhardy commented Jun 14, 2019

As I said in the other issue, use the target wasm32-wasi (check the changelog).

@devsnek
Copy link
Author

devsnek commented Jun 14, 2019

updating to rustc beta and using wasm32-wasi produces the same error.

@newpavlov
Copy link
Member

newpavlov commented 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 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.

@devsnek
Copy link
Author

devsnek commented Jun 14, 2019

using rand 0.7.0-pre.1 worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants