I have compiled CPython using the WASI SDK with threading support, but I'm getting an error when trying to run under wasmtime that I don't get from a non-threaded build and I'm not sure how to solve it:
❯ WASMTIME_BACKTRACE_DETAILS=1 wasmtime --wasi-modules experimental-wasi-threads --wasm-features all --dir . --mapdir /tmp::/tmp python.wasm
Error: failed to run main module `python.wasm`
Caused by:
0: failed to invoke command default
1: error while executing at wasm backtrace:
0: 0x394497 - <unknown>!__wasi_clock_time_get
1: 0x34d8af - <unknown>!init
2: 0x544e - <unknown>!__wasm_call_ctors
3: 0x5513 - <unknown>!_start
2: missing required memory export
I feel like I'm missing a flag or something (either for wasmtime or WASI SDK), but I can't figure out what other flag to try or what could be causing this as everything compiles fine. And as I said, everything works fine in a non-threaded build, so this seems specific to that.
I think you'll want -Wl,--export-memory
(the --export-memory
to wasm-ld
) to get past that check
threaded modules for WASI need to both import and export their memory right now
Thanks! I opened https://github.com/python/cpython/issues/111046 to track this.
Last updated: Nov 22 2024 at 16:03 UTC