Any tips on debugging this? It's in a rust guest exported function. The export works fine until I try to call a function from a third party crate in it, but calling the function creates the error
RuntimeError: unreachable
at __wasi_proc_exit (<anonymous>:wasm-function[482]:0x1c73a)
at _Exit (<anonymous>:wasm-function[483]:0x1c740)
at __wasilibc_populate_preopens (<anonymous>:wasm-function[491]:0x1cc42)
at __wasm_call_ctors (<anonymous>:wasm-function[17]:0xbfa)
if i were just compiling, I guess I could add a flag for better errors, but not quite sure how to do that executing the wasm module from a js host
The only cases __wasilibc_populate_preopens
calls _Exit
seem to be when fd_prestat_get
or fd_prestat_dir_name
return an error.
Are you treating the wasm module as a library and calling a function other than the start function? If so you will need to compile as a wasi reactor rather than wasi command like is the default.
A wasi command has it's start function called once and after that can't be called into again. A wasi reactor has an initialize function called once and after that you can call any exported function you want.
@Daniel Macovei
Last updated: Dec 23 2024 at 13:07 UTC