Building Godot Wasm with the Wasmtime runtime enabled (wasm_runtime=wasmtime) fails to compile.
Firstly, the addon only builds on Windows with Wasmtime enabled because it is dynamically linking the Wasmtime DLL. Adding the C++ defines WASM_API_EXTERN and WASI_API_EXTERN prevents dynamic linking as recommended in wasmtime#7808. This is because the Wasmtime wasm.h does not include checks for LIBWASM_STATIC as implemented in wasm-c-api#183.
When the defines are provided, build fails with the following (truncated) errors.
wasmtime\include\wasm.h(96): error C2059: syntax error: 'constant'
wasmtime\include\wasm.h(110): error C3861: 'wasm_byte_vec_new': identifier not found
wasmtime\include\wasm.h(116): error C3861: 'wasm_byte_vec_new': identifier not found
wasmtime\include\wasm.h(125): error C2059: syntax error: 'constant'
wasmtime\include\wasm.h(127): error C2059: syntax error: 'constant'
wasmtime\include\wasm.h(134): error C2059: syntax error: 'constant'
A WIP branch was created to debug. I thought this could be a #define macro conflict so added a GODOT_WASM_ prefix to all macros. Still could be a macro conflict with Godot C++ library and Wasmtime. See this GHA run for failure example.
It's possible to get Wasmtime working with Windows by modifying the addons/godot-wasm/godot-wasm.gdextension file to include wasmtime.dll as a dependency and including wasmtime.dll in the addons directory. An example of such a workaround can be seen here with the following context provided.
Compiling with the Wasmtime runtime on Windows is failing static linking as of Godot Wasm v0.3.4. In addition to the built Godot Wasm binaries, you'll need to copy wasmtime.dll to GODOT_DOOM_DIR/addons/godot-wasm/bin/windows and to update godot-wasm.gdextension to include the Wasmtime DLL as a dependency. Refer to the addons directory of the project source.
Ideally, building with the Wasmtime runtime would produce a single Windows binary similar to what's being done for Wasmer.
Building Godot Wasm with the Wasmtime runtime enabled (
wasm_runtime=wasmtime
) fails to compile.Firstly, the addon only builds on Windows with Wasmtime enabled because it is dynamically linking the Wasmtime DLL. Adding the C++ defines
WASM_API_EXTERN
andWASI_API_EXTERN
prevents dynamic linking as recommended in wasmtime#7808. This is because the Wasmtimewasm.h
does not include checks forLIBWASM_STATIC
as implemented in wasm-c-api#183.When the defines are provided, build fails with the following (truncated) errors.
A WIP branch was created to debug. I thought this could be a
#define
macro conflict so added aGODOT_WASM_
prefix to all macros. Still could be a macro conflict with Godot C++ library and Wasmtime. See this GHA run for failure example.It's possible to get Wasmtime working with Windows by modifying the addons/godot-wasm/godot-wasm.gdextension file to include wasmtime.dll as a dependency and including wasmtime.dll in the addons directory. An example of such a workaround can be seen here with the following context provided.
Ideally, building with the Wasmtime runtime would produce a single Windows binary similar to what's being done for Wasmer.