Stream: wamr

Topic: Compile WAMR with Emscripten?


view this post on Zulip Jordan Werthman (Aug 13 2025 at 01:37):

I am working on a small hobby project which intends to run WAMR on an ESP32 exposing a small set of custom native functions for applications to work with on the ESP32. I would also like to build a small web front-end to demo applications and test... to that end I was hoping to build the exact same runtime (WAMR) on both the ESP32 and for the Web (using Emscripten) with the same native functions wired up in both environments. Cross-compiling to Emscripten does not work out of the box but #if 0/#endif out the contents of platform_wasi_types.h and selecting WAMR_BUILD_INVOKE_NATIVE_GENERAL in CMake does make everything compile.. unfortunately it does not work when run.

I suspect that the general invokeNative does not work for Emscripten but am at a bit of a loss on how I could make it work with the JS runtime... any advice would be greatly appreciated. I have experience with embedded systems but not much with WASM.

P.S. I am only trying to run in interpreted mode right now.

view this post on Zulip lum1n0us (Aug 19 2025 at 10:03):

I'm not entirely clear on the part about "building WAMR for the web with emscripten." Is it suggesting that WAMR is translated into a WebAssembly application using emscripten?

view this post on Zulip YAMAMOTO Takashi (Aug 21 2025 at 10:15):

as wasm is strict on function types, i don't think there is a reasonable way to implement invokeNative as of today for wasm.

view this post on Zulip mainrs (Sep 17 2025 at 08:13):

Sorry! wanted to open a new issue.


Last updated: Dec 06 2025 at 07:03 UTC