Skip to content

JS: Missing missing HEAP8 in EMCC EXPORTED_RUNTIME_METHODS #2427

@ymeister

Description

@ymeister

GHC issue: https://gitlab.haskell.org/ghc/ghc/-/issues/26290

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions