Skip to content

JS: Missing missing HEAP8 in EMCC EXPORTED_RUNTIME_METHODS

Summary

Cannot run any resulting JS code on GHC-9.12.2 and emscripten-4.0.8 built via haskell.nix.

Steps to reproduce

main :: IO ()
main = putStrLn "Hello world!"

running it results in:

Aborted('HEAP8' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ))
/nix/store/hwd9jkdfr19bazq3j7mc05crg2kxl4am-hello-world-exe-hello-world-0.1.0.0/bin/hello-world:52245
  var e = new WebAssembly.RuntimeError(what);

Expected behavior

Hello world!

Environment

  • GHC version used: 9.12.2

Optional:

  • Operating System: NixOS
  • System Architecture: x86_64
  • Haskell.nix version (or commit) used: e567ebc (tag: 2025.08.03)

Fix

-----------------------
modified: rts/js/mem.js
-----------------------
@@ -1,5 +1,5 @@
 //#OPTIONS:CPP
-//#OPTIONS:EMCC:EXPORTED_RUNTIME_METHODS=addFunction,removeFunction,getEmptyTableSlot
+//#OPTIONS:EMCC:EXPORTED_RUNTIME_METHODS=addFunction,removeFunction,getEmptyTableSlot,HEAP8
Edited by Yuri Meister
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information