Open vu3rdd opened 3 years ago
I'm getting a similar bunch of errors while trying to build a source file that includes a large library that is pre-built in the asterius docker image. I am building a source file that is available in the hledger source code tree and it utilizes the hledger-lib library which is prebuilt.
I can reproduce this issue, from the asterius docker shell using these two lines:
git clone https://github.com/simonmichael/hledger.git && cd hledger && git checkout 1.18-branch && cd bin
ahc-link --input-hs hledger-check.hs --run
Here is the beginning of the output, although it continues on to give many more of the same error about "unexpected false":
[INFO] Compiling hledger-check.hs to WebAssembly [1 of 1] Compiling Main ( hledger-check.hs, hledger-check.o ) Linking /tmp/hledger-check391-0 ... [INFO] Converting linked IR to binaryen IR [INFO] Running binaryen optimization [INFO] Validating binaryen IR [wasm-validator error in function regexzmtdfazm1zi3zi1zi0zm16m11FfqhKd3wPZZTDHF5VzzTextziRegexziTDFAziNewDFAziEngine.Lc5m7A] unexpected false: non-final block elements returning a value must be drop()ed (binaryen's autodrop option might help you), on ................. [many lines of output]
Any thoughts on anything I could try to further diagnose this? This error definitely comes from the binaryen project (I found it in their source code) but I wouldn't know whether this is a false positive error or whether there is truly an issue with asterius.
EDIT: Sorry for the noise, the error vanished because I passed --no-validation
to ahc-dist
(I've overseen that flag) and Cloudflare didn't accept the bundle. So the below doesn't hold and you can count me in on this issue. :/
I haven't looked into the provided repositories. I stumbled over this issue as well and it took me a while to find the problem – I forgot to set
ghc-options: -optl--export-function=handleFetch
in the cabal file. You might want to check that.
(I found this here: https://blog.cloudflare.com/cloudflare-worker-with-webassembly-and-haskell/ not sure if it's documented somewhere else.)
Describe the bug
I am trying to build the magic-wormhole project to web assembly using Asterius. During the
ahc-dist
phase, it quits at the wasm-validator phase with errors similar to this:To Reproduce
Expected behavior
Was expecting to see a wasm module generated.
Environment
Additional context
None