fails to run compiled wasm with `wasmtime` v15
- moc 0.10.2
- compiled with
-wasi-system-apiflag - wasmtime command
wasmtime --max-wasm-stack=2000000 --enable-cranelift-nan-canonicalization --wasm-features multi-memory,bulk-memory <file>
Error:
unknown import: `wasi_unstable::fd_write` has not been defined
Thanks for reporting!
Which wasmtime? We use 10.0.2.
wasmtime 15.0.0, released 2023-11-20
(oh, sorry, just noticed the title ;->)
Are you blocked by this or is it an FYI?
Not a blocker, but it would be nice to fix) I just found my CI is failing because it installs the latest wasmtime.
I've investigated a bit. We only actually use 1 function from Wasi (I believe) but the module name has change from "wasi_unstable" to something else "wasi_snapshot_preview1" (I think).
I'm not sure how easy it is to upgrade the version of wasmtime we use in CI (it might be dictated by the was we use nix somehow @ggreif), but I found a wasmtime flag that lets you use the legacy version of the wasi api that we seem to still target
(-S preview2=n).
For wasmtime 15.0.0, these options seem to work, without modifying the compiler. wasmtime -S preview2=n -C cache=n -W bulk-memory -W multi-memory foo.wasm
Unfortunately, I don't see how to emulate the old 10.0.2 --enable-cranelift-nan-canonicalization flag using a command-line flag.
diff:
-WASMTIME_OPTIONS="--disable-cache --enable-cranelift-nan-canonicalization --wasm-features multi-memory,bulk-memory"
+WASMTIME_OPTIONS="-S preview2=n -C cache=n -W bulk-memory -W multi-memory"
Perhaps we could add a moc flag for the different wasi api versions... or just target the latest one if we can update our CI.