-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Closed
Copy link
Description
Please include the following in your bug report:
Version of emscripten/emsdk: 3.1.67 (and likely latest)
Failing command line in full:
Compiling absl::random code in standalone mode results in a wasm module that crashes. Sample code:
absl::BitGen bitgen;
int digit = absl::Uniform(bitgen, 0, 2);The reason is that Abseil under Emscripten uses the getentropy() syscall as a seed: https://github.com/abseil/abseil-cpp/blob/07fff76ed619672bb7bf00939231ba45aef2b043/absl/random/internal/seed_material.cc#L60-L64
And standalone Emscripten defaults to a crashing implementation:
emscripten/system/lib/standalone/standalone.c
Lines 139 to 143 in b53978e
| // There is no good source of entropy without an import. Make this weak so that | |
| // it can be replaced with a pRNG or a proper import. | |
| weak int getentropy(void* buffer, size_t length) { | |
| abort(); | |
| } |
Would it be reasonable to use wasi_snapshot_preview1.random_get() to implement getentropy()?
Metadata
Metadata
Assignees
Labels
No labels