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

Missing WASM setup docs related to ahash/getrandom #2009

Closed
elimerl opened this issue Sep 6, 2022 · 3 comments
Closed

Missing WASM setup docs related to ahash/getrandom #2009

elimerl opened this issue Sep 6, 2022 · 3 comments

Comments

@elimerl
Copy link

elimerl commented Sep 6, 2022

I was trying to setup egui for a WASM project, and it took about 15 minutes of searching to find that I had to manually add getrandom as a dependency for it to work on WASM:

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }

If possible there should be clearer documentation for setting up on WASM, specifically for this issue. I had to look at commit 5514a8afda53c282d2be670bef657d5c7812d467 to find the solution.

Thanks!

@coderedart
Copy link
Contributor

is this something that ahash crate should be fixing? ahash can provide an optional feature which toggles the js feature of getrandom.

the current method sounds more like a hack to me

reference: tkaitchuck/aHash#59

@emilk
Copy link
Owner

emilk commented Sep 7, 2022

It seems like this can be solved by not using the (default) runtime-rng feature of ahash. That is: if the egui crates has ahash = { version = "0.8", default-features = false, features = ["compile-time-rng", "std"] } then there is no dependency on getrandom.

…but we get a lot of other dependencies instead, which likely will increase compile times.

Maybe ahash could have a fixed-seed feature flag which doesn't require any dependencies (and doesn't protect against DOS attacks, which egui doesn't really care about anyways, and egui users can still opt-in to)

@emilk emilk changed the title Missing WASM setup docs Missing WASM setup docs related to ahash/getrandom Sep 7, 2022
@elimerl
Copy link
Author

elimerl commented Sep 18, 2022

Looks this is fixed, thanks!

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