From 5d4390d28109050a26e10bc40d1dc577406c0071 Mon Sep 17 00:00:00 2001 From: Enes Grahovac <34563104+enesgrahovac@users.noreply.github.com> Date: Sat, 10 May 2025 00:44:13 -0400 Subject: [PATCH] examples : add HEAPU8 to all of the exported runtime methods (#3134) This commit adds HEAPU8 to the list of exported methods. The motivation for this commit is that currently this is causing an error on Window systems where HEAPU8 in undefined, which results in the following error message in the web console: main.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'buffer') at __emval_get_property (main.js:1:1363125) at 003a453a:0xc4a47 at 003a453a:0xc51cd at Object.full_default (eval at craftInvokerFunction (main.js:1:1347011), :9:10) at whisper.cpp/:647:42 danbev originally fixed this for whisper.wasm, stream.wasm, and command.stream, but the issue still exists on the other examples which I patch in this code. Resolves: #3059 --- examples/bench.wasm/CMakeLists.txt | 2 +- examples/wchess/wchess.wasm/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bench.wasm/CMakeLists.txt b/examples/bench.wasm/CMakeLists.txt index 5e9f68d2..8e134aa3 100644 --- a/examples/bench.wasm/CMakeLists.txt +++ b/examples/bench.wasm/CMakeLists.txt @@ -35,7 +35,7 @@ set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \ -s INITIAL_MEMORY=2000MB \ -s TOTAL_MEMORY=2000MB \ -s FORCE_FILESYSTEM=1 \ - -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \ + -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap', 'HEAPU8']\" \ ${EXTRA_FLAGS} \ ") diff --git a/examples/wchess/wchess.wasm/CMakeLists.txt b/examples/wchess/wchess.wasm/CMakeLists.txt index 60967b19..0d3dd908 100644 --- a/examples/wchess/wchess.wasm/CMakeLists.txt +++ b/examples/wchess/wchess.wasm/CMakeLists.txt @@ -32,7 +32,7 @@ set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \ -s INITIAL_MEMORY=1024MB \ -s TOTAL_MEMORY=1024MB \ -s FORCE_FILESYSTEM=1 \ - -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \ + -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap', 'HEAPU8']]\" \ ${EXTRA_FLAGS} \ ")