aboutsummaryrefslogtreecommitdiffstats
path: root/docs/building/index.html
blob: 976571db9e2ede22ba898a7de8272681ae7c71a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!doctype html><html lang=en><head><meta name=generator content="Hugo 0.80.0"><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="To build Vericert, the provided Makefile can be used. External dependencies are needed to build the project, which can be pulled in automatically with nix using the provided default.nix and shell.nix files.
The project is written in Coq, a theorem prover, which is extracted to OCaml so that it can then be compiled and executed. The dependencies of this project are the following:
 Coq: theorem prover that is used to also program the HLS tool."><meta name=theme-color content="#FFFFFF"><meta property="og:title" content="Building Vericert"><meta property="og:description" content="To build Vericert, the provided Makefile can be used. External dependencies are needed to build the project, which can be pulled in automatically with nix using the provided default.nix and shell.nix files.
The project is written in Coq, a theorem prover, which is extracted to OCaml so that it can then be compiled and executed. The dependencies of this project are the following:
 Coq: theorem prover that is used to also program the HLS tool."><meta property="og:type" content="article"><meta property="og:url" content="https://vericert.ymhg.org/docs/building/"><title>Building Vericert | Vericert</title><link rel=manifest href=/manifest.json><link rel=icon href=/favicon.png type=image/x-icon><link rel=stylesheet href=/book.min.cc7f7da4e201466c24d4145b227311a8f1462dd7940d82e2d55c370645cf9541.css integrity="sha256-zH99pOIBRmwk1BRbInMRqPFGLdeUDYLi1Vw3BkXPlUE="><script defer src=/en.search.min.0954d4b2fc6bff27e6f999bbc5c4fd9011adb3be3811a6642db8ce343b98ef63.js integrity="sha256-CVTUsvxr/yfm+Zm7xcT9kBGts744EaZkLbjONDuY72M="></script></head><body><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><nav><h2 class=book-brand><a href=/><span>Vericert</span></a></h2><div class=book-search><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><ul><li><a href=https://vericert.ymhg.org/coq-style-guide/>Coq Style Guide</a></li><li><a href=https://vericert.ymhg.org/docs/>Docs</a><ul><li><a href=https://vericert.ymhg.org/docs/building/ class=active>Building Vericert</a></li><li><a href=https://vericert.ymhg.org/docs/using-vericert/>Using Vericert</a></li></ul></li></ul><ul><li><a href=https://github.com/ymherklotz/vericert target=_blank rel=noopener>Github</a></li></ul></nav><script>(function(){var menu=document.querySelector("aside.book-menu nav");addEventListener("beforeunload",function(event){localStorage.setItem("menu.scrollTop",menu.scrollTop);});menu.scrollTop=localStorage.getItem("menu.scrollTop");})();</script></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/svg/menu.svg class=book-icon alt=Menu></label>
<strong>Building Vericert</strong>
<label for=toc-control><img src=/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><ul><li><a href=#downloading-compcert>Downloading CompCert</a></li><li><a href=#setting-up-nix>Setting up Nix</a></li><li><a href=#makefile-build>Makefile build</a></li><li><a href=#testing>Testing</a></li></ul></li></ul></nav></aside></header><article class=markdown><p>To build Vericert, the provided Makefile can be used. External dependencies are needed to build the project, which can be pulled in automatically with <a href=https://nixos.org/nix/>nix</a> using the provided <code>default.nix</code> and <code>shell.nix</code> files.</p><p>The project is written in Coq, a theorem prover, which is extracted to OCaml so that it can then be compiled and executed. The dependencies of this project are the following:</p><ul><li><a href=https://coq.inria.fr/>Coq</a>: theorem prover that is used to also program the HLS tool.</li><li><a href=https://ocaml.org/>OCaml</a>: the OCaml compiler to compile the extracted files.</li><li><a href=https://github.com/mit-plv/bbv>bbv</a>: an efficient bit vector library.</li><li><a href=https://github.com/ocaml/dune>dune</a>: build tool for ocaml projects to gather all the ocaml files and compile them in the right order.</li><li><a href=http://gallium.inria.fr/~fpottier/menhir/>menhir</a>: parser generator for ocaml.</li><li><a href=https://github.com/ocaml/ocamlfind>findlib</a> to find installed OCaml libraries.</li><li><a href=https://gcc.gnu.org/>GCC</a>: compiler to help build CompCert.</li></ul><p>These dependencies can be installed manually, or automatically through Nix.</p><h2 id=downloading-compcert>Downloading CompCert
<a class=anchor href=#downloading-compcert>#</a></h2><p>CompCert is added as a submodule in the <code>lib/CompCert</code> directory. It is needed to run the build process below, as it is the one dependency that is not downloaded by nix, and has to be downloaded together with the repository. To clone CompCert together with this project, you can run:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>git clone --recursive https://github.com/ymherklotz/vericert
</code></pre></div><p>If the repository is already cloned, you can run the following command to make sure that CompCert is also downloaded:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>git submodule update --init
</code></pre></div><h2 id=setting-up-nix>Setting up Nix
<a class=anchor href=#setting-up-nix>#</a></h2><p>Nix is a package manager that can create an isolated environment so that the builds are reproducible. Once nix is installed, it can be used in the following way.</p><p>To open a shell which includes all the necessary dependencies, one can use:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>nix-shell
</code></pre></div><p>which will open a shell that has all the dependencies loaded.</p><h2 id=makefile-build>Makefile build
<a class=anchor href=#makefile-build>#</a></h2><p>If the dependencies were installed manually, or if one is in the <code>nix-shell</code>, the project can be built by running:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>make -j8
</code></pre></div><p>and installed locally, or under the <code>PREFIX</code> location using:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>make install
</code></pre></div><p>Which will install the binary in <code>./bin/vericert</code> by default. However, this can be changed by changing the <code>PREFIX</code> environment variable, in which case the binary will be installed in <code>$PREFIX/bin/vericert</code>.</p><h2 id=testing>Testing
<a class=anchor href=#testing>#</a></h2><p>To test out <code>vericert</code> you can try the following examples which are in the test folder using the following:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>./bin/vericert test/loop.c -o loop.v
./bin/vericert test/conditional.c -o conditional.v
./bin/vericert test/add.c -o add.v
</code></pre></div><p>Or by running the test suite using the following command:</p><div class=highlight><pre class=chroma><code class=language-shell data-lang=shell>make <span class=nb>test</span>
</code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div></footer><div class=book-comments></div><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><nav id=TableOfContents><ul><li><ul><li><a href=#downloading-compcert>Downloading CompCert</a></li><li><a href=#setting-up-nix>Setting up Nix</a></li><li><a href=#makefile-build>Makefile build</a></li><li><a href=#testing>Testing</a></li></ul></li></ul></nav></aside></main></body></html>