Stream: wasmtime

Topic: `missing required memory export` for threaded CPython


view this post on Zulip Brett Cannon (Oct 18 2023 at 17:49):

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.

Unofficial WASI builds of CPython. Contribute to brettcannon/cpython-wasi-build development by creating an account on GitHub.
Unofficial WASI builds of CPython. Contribute to brettcannon/cpython-wasi-build development by creating an account on GitHub.

view this post on Zulip Alex Crichton (Oct 18 2023 at 18:00):

I think you'll want -Wl,--export-memory (the --export-memory to wasm-ld) to get past that check

view this post on Zulip Alex Crichton (Oct 18 2023 at 18:00):

threaded modules for WASI need to both import and export their memory right now

view this post on Zulip Brett Cannon (Oct 18 2023 at 22:14):

Thanks! I opened https://github.com/python/cpython/issues/111046 to track this.

Bug report Bug description: https://bytecodealliance.zulipchat.com/#narrow/stream/217126-wasmtime/topic/.60missing.20required.20memory.20export.60.20for.20threaded.20CPython/near/397361259 I think ...

Last updated: Nov 22 2024 at 16:03 UTC