We have two types of runtime examples:
- A C/C++ runtime example, which is a minimal runtime based on WAMR. see runtime/cpp for more details.
- A Rust runtime example, which is a more complex runtime based on Wasmtime. see runtime/cli for more details.
A new runtime is easy to implement with only a few hundred lines of code, in any language, using any wasm runtime or any ebpf user space library.
Build the C++ minimal runtime based on WAMR1
The dependencies are libbpf and wasm-micro-runtime only, they are registered as git submodules.
git submodule update --init --recursive
cd runtime/cppYou will need clang, libelf and zlib to build the examples,
package names may vary across distros.
on Ubuntu/Debian, you need:
sudo apt install clang libelf1 libelf-dev zlib1g-devon CentOS / Fedora, you need:
sudo dnf install clang elfutils-libelf elfutils-libelf-devel zlib-develRun make in the runtime/cpp directory to build the runtime, which will be placed in the build
directory. cmake is required to build the runtime.
make buildmake build-libYou may refer to CI for more details on how to build and run the examples.
Build the Rust runtime based on Wasmtime2
install rust toolchain
curl https://sh.rustup.rs -sSf | sh -sRun make in the runtime/cli directory to build the runtime, which will be placed in the target
directory.
make buildFootnotes
-
WAMR (WebAssembly Micro Runtime): https://github.com/bytecodealliance/wasm-micro-runtime ↩