Wasmtime: Add example binfmt interpreter

Created on 17 Jul 2019  路  5Comments  路  Source: bytecodealliance/wasmtime

I have a binfmt configuration setup to use wasmtime like this:

:wasm32-wasi:M::\x00asm:\xff\xff\xff\xff:/run/binfmt/wasmtime:

It might be useful to others. Some documentation or an example .conf could be provided.

help wanted

Most helpful comment

As soon as wasmtime depends on you specifying command line flags sometimes, this has limited application.

It probably needs more thinking and involved establishing a "contract" within wasmtime that a user should always get a full experience without any flags.

All 5 comments

Fun! I agree, it'd be nice to document this.

https://www.freedesktop.org/software/systemd/man/binfmt.d.html#

Looks like dropping that binfmt string into /etc/binfmt.d/wasmtime.conf should be enough on systemd systems. After that, I loaded the config by restarting the systemd-binfmt.service unit.

sudo systemctl restart systemd-binfmt

After that, I can execute wasm binaries directly.

As soon as wasmtime depends on you specifying command line flags sometimes, this has limited application.

It probably needs more thinking and involved establishing a "contract" within wasmtime that a user should always get a full experience without any flags.

I just added a Docker image to make this easy to try out with minimum setup work. Info available at https://hub.docker.com/repository/docker/renefonseca/wasmtime .

This is untested, but an example to play with for the wast files I think should look like this.

:wasm32-wast:E:0:wat::/run/binfmt/wasmtime:

Was this page helpful?
0 / 5 - 0 ratings