Essentially what is happening is the Setup.hs file uses inline assembly to call rdrand which is not supported for JS because emscripten does not support it.
So the fix is to either write that assembly in portable C/C++ or write some javascript that does the same thing and use and ifdef to catch when entropy is being cross-compiled.
I'm more than happy to write the js if you need it, but I wanted to defer to the author of the library to make the decision on how best to proceed.
Reading through the Setup.hs more carefully I don't think this error is actually meaningful. Its thrown by emcc during checkRDRAND but the result will be caught by checkGetRandom which compiles just fine. So if anything the change should be to catch stderrhere.
See this ticket: https://github.com/NixOS/nixpkgs/issues/337996
for the whole story.
Essentially what is happening is the
Setup.hs
file uses inline assembly to callrdrand
which is not supported for JS because emscripten does not support it.So the fix is to either write that assembly in portable C/C++ or write some javascript that does the same thing and use and
ifdef
to catch whenentropy
is being cross-compiled.I'm more than happy to write the js if you need it, but I wanted to defer to the author of the library to make the decision on how best to proceed.