Vellvm is an ongoing project aiming at the formal verification in the Rocq proof assistant of a compilation infrastructure inspired by the LLVM compiler.
Check out the Vellvm home page for more information.
- OCaml 4.14.1 (typically installed via
opam, see below) - Rocq 9.1.1
- opam 2.0.0+
- Clang 14.0.1+ (available for Mac OSX in XCode 4.2+, or installed via, e.g.
sudo apt-get install clang) gnu-sedseddefaults tognu-sedon linux.- for Mac OS X with homebrew, do
brew install gnu-sedand then create a symlink fromsedto thegsedexecutable in your path.)
- Clone the vellvm git repo with the
--recurse-submoduleoption- If you forgot to clone recursively, run
git submodule update --init --recursiveto fetch the extra libraries inlib/
- If you forgot to clone recursively, run
- Install all external dependencies
- Note: you should be able to install all of the opam libraries by running
make opamin thesrc/directory.
- Note: you should be able to install all of the opam libraries by running
- Run
make vellvmin thesrc/directory: it will produce the OCaml executable calledvellvm- Note: running just
makewill also build all of Vellvm's metatheory, which is necessary for proving things, but takes much longer
- Note: running just
opam is available via homebrew on Mac, and most system's package managers on Linux, e.g. sudo apt-get install opam.
If this is the first time you are using opam you need to initialize it:
- On Linux:
opam init - On Mac:
opam init --disable-sandboxing(sandboxing needs to be disabled due to a known issue).
Then:
-
Create a vellvm development opam switch with:
opam switch create vellvm ocaml-base-compiler.4.14.1. -
Make sure the switch is activated (see the instructions in the output of the previous command), e.g.:
eval $(opam env --switch=vellvm)(omit the dollar sign if using fish shell) -
Add the Rocq package repository:
opam repo add rocq-released https://rocq-prover.org/opam/released. -
Install Rocq:
opam pin add rocq-core 9.1.1 -
Install opam dependencies (run in the root directory of the project):
opam install -y --verbose --deps-only .
Note: the dependency constraints in the opam file should be sufficient
for installing vellvm, however if you are having compilation
problems checking the logs from CI may give you the appropriate
versions,
as shown
here.
If you are a nix user, another way to install / compile Vellvm is with nix. Instructions can be found here.
See the details over on the Vellvm page. The TLDR is:
The executable vellvm will be found in src/.
Do src/vellvm -help from the command line to see all available options.
In particular:
src/vellvm -i tests/ll/factorial.llto run the interpreter on a given file.cd src && ./vellvm -testto run the test suitesrc/vellvm -test-file tests/ll/gep2.llto test a specific file using inlined assertions