Skip to content

Latest commit

 

History

History
74 lines (48 loc) · 1.83 KB

build.md

File metadata and controls

74 lines (48 loc) · 1.83 KB

Build the runtime and examples

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/cpp

Install Dependencies

You 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-dev

on CentOS / Fedora, you need:

sudo dnf install clang elfutils-libelf elfutils-libelf-devel zlib-devel

Build runtime as a executable tool

Run 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 build

Build runtime as a library

make build-lib

You 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 -s

Build runtime as a executable tool

Run make in the runtime/cli directory to build the runtime, which will be placed in the target directory.

make build

Footnotes

  1. WAMR (WebAssembly Micro Runtime): https://github.com/bytecodealliance/wasm-micro-runtime

  2. wasmtime: https://github.com/bytecodealliance/wasmtime