File: README.md

package info (click to toggle)
rust-wasmtime 26.0.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 48,492 kB
  • sloc: ansic: 4,003; sh: 561; javascript: 542; cpp: 254; asm: 175; ml: 96; makefile: 55
file content (37 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
wasm-spec-interpreter
=====================

This project shows how to use `ocaml-interop` to call into the Wasm spec
interpreter. There are several steps to making this work:
 - building the OCaml Wasm spec interpreter as a static library
 - building a Rust-to-OCaml FFI bridge using `ocaml-interop` and a custom OCaml
   wrapper
 - linking both things into a Rust crate

### Dependencies

This crate only builds in an environment with:
- `make` (the Wasm spec interpreter uses a `Makefile`)
- `ocamlopt`, `ocamlbuild` (available with, e.g., `dnf install ocaml`)
- Linux tools (e.g. `ar`); currently it is easiest to build the static
  libraries in a single environment but this could be fixed in the future (TODO)
- `libgmp`, for the OCaml `zarith` package
- `git` is used by `build.rs` to retrieve the repository containing the Wasm
  spec interpreter; it is safe to completely remove `ocaml/spec` to get a new
  copy

### Build

```
cargo build --features build-libinterpret
```

Use `FFI_LIB_DIR=path/to/lib/...` to specify a different location for the static
library (this is mainly for debugging). If the `build-libinterpret` feature is
not provided, this crate will build successfully but fail at runtime.

### Test

```
cargo test --features build-libinterpret
```