fuzz: improve wasm-spec-interpreter documentation, add library path (#4007)

The documentation for the `wasm-spec-interpreter` was not up-to-date,
causing some confusion on non-Ubuntu machines. This change adds the
correct dependencies to install and includes the `libgmp` path for
Fedora by default (i.e., `/lib64`).
This commit is contained in:
Andrew Brown
2022-04-11 07:07:58 -07:00
committed by GitHub
parent 1bf0c8c220
commit 0c7885cc05
3 changed files with 10 additions and 12 deletions

View File

@@ -15,25 +15,23 @@ This crate only builds in an environment with:
- `ocamlopt`, `ocamlbuild` (available with, e.g., `dnf install ocaml`) - `ocamlopt`, `ocamlbuild` (available with, e.g., `dnf install ocaml`)
- Linux tools (e.g. `ar`); currently it is easiest to build the static - 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) libraries in a single environment but this could be fixed in the future (TODO)
- `libgmp`, for the OCaml `zarith` package
Remember to retrieve the Wasm spec submodule: - `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
git clone ... --recursive
```
### Build ### Build
``` ```
RUSTFLAGS=--cfg=fuzzing cargo build cargo build --features build-libinterpret
``` ```
Use `FFI_LIB_DIR=path/to/lib/...` to specify a different location for the static Use `FFI_LIB_DIR=path/to/lib/...` to specify a different location for the static
library (this is mainly for debugging). If the `--cfg=fuzzing` configuration is library (this is mainly for debugging). If the `build-libinterpret` feature is
not provided, this crate will build successfully but fail at runtime. not provided, this crate will build successfully but fail at runtime.
### Test ### Test
``` ```
RUSTFLAGS=--cfg=fuzzing cargo test cargo test --features build-libinterpret
``` ```

View File

@@ -13,7 +13,7 @@ SPEC_LIB := $(SPEC_BUILD_DIR)/wasm.cmxa
# A space-separated list of paths that the linker will use to search for libgmp. # A space-separated list of paths that the linker will use to search for libgmp.
# Override with `make LIBGMP_PATHS=...`. # Override with `make LIBGMP_PATHS=...`.
LIBGMP_PATHS ?= /usr/lib /usr/lib/x86_64-linux-gnu LIBGMP_PATHS ?= /usr/lib /usr/lib/x86_64-linux-gnu /lib64
PKGS = zarith PKGS = zarith

View File

@@ -6,5 +6,5 @@ access to the Wasm spec interpreter. Its major parts:
for FFI access for FFI access
- `Makefile`: the steps for gluing these pieces together into a static library - `Makefile`: the steps for gluing these pieces together into a static library
Note: the makefile must be configured with the path to libgmp. See LIBGMP_PATHS Note: the `Makefile` must be configured with the path to `libgmp.a`; see
in the makefile. `LIBGMP_PATHS` in the `Makefile` (Ubuntu: `libgmp-dev`, Fedora: `gmp-static`).