| 1 | Installing From Sources |
| 2 | ======================= |
| 3 | |
| 4 | To install and use Rocq, we recommend relying on [the Rocq |
| 5 | platform](https://github.com/rocq-prover/platform) or on a package manager |
| 6 | (e.g. opam or Nix). Opam 2.3 is known to work on Unix-like, macOS, and |
| 7 | native Windows platforms. |
| 8 | |
| 9 | See https://rocq-prover.org/install to learn more. |
| 10 | |
| 11 | If you need to build Rocq from sources manually (e.g. to |
| 12 | contribute to Rocq or to write a Rocq package), the remainder of this |
| 13 | file explains how to do so. |
| 14 | |
| 15 | Build Requirements |
| 16 | ------------------ |
| 17 | |
| 18 | To compile Rocq yourself, you need: |
| 19 | |
| 20 | - [OCaml](https://ocaml.org/) (version >= 4.14.0) |
| 21 | (This version of Rocq has been tested up to OCaml 4.14.1, for the 4.x series) |
| 22 | |
| 23 | Support for OCaml 5.x remains experimental. |
| 24 | |
| 25 | - The [Dune OCaml build system](https://github.com/ocaml/dune/) >= 3.8 |
| 26 | |
| 27 | - The [ZArith library](https://github.com/ocaml/Zarith) >= 1.11 |
| 28 | |
| 29 | - The [findlib](http://projects.camlcity.org/projects/findlib.html) library (version >= 1.9.1) |
| 30 | |
| 31 | - a C compiler |
| 32 | |
| 33 | - an IEEE-754 compliant architecture with rounding to nearest |
| 34 | ties to even as default rounding mode (most architectures |
| 35 | should work nowadays) |
| 36 | |
| 37 | - for RocqIDE, the |
| 38 | [lablgtk3-sourceview3](https://github.com/garrigue/lablgtk) library |
| 39 | (version >= 3.1.2), and the corresponding GTK 3.x libraries, as |
| 40 | of today (gtk+3 >= 3.18 and gtksourceview3 >= 3.18) |
| 41 | |
| 42 | - [optional] GNU Make (version >= 3.81) |
| 43 | |
| 44 | Primitive floating-point numbers require IEEE-754 compliance |
| 45 | (`Require Import Floats`). Common sources of incompatibility |
| 46 | are checked at configure time, preventing compilation. In the |
| 47 | unlikely event an incompatibility remains undetected, using `Floats` |
| 48 | would enable proving `False` on this architecture. |
| 49 | |
| 50 | Note that OCaml dependencies (`zarith` and `lablgtk3-sourceview3` at |
| 51 | this moment) must be properly registered with `findlib/ocamlfind` |
| 52 | since Rocq's build system uses `findlib` to locate them. |
| 53 | |
| 54 | Debian / Ubuntu users can get the necessary system packages for |
| 55 | RocqIDE with: |
| 56 | |
| 57 | $ sudo apt-get install libgtksourceview-3.0-dev |
| 58 | |
| 59 | Opam (https://opam.ocaml.org/) is recommended to install OCaml and |
| 60 | the corresponding packages. |
| 61 | |
| 62 | $ opam switch create rocq --packages="ocaml-variants.4.14.1+options,ocaml-option-flambda" |
| 63 | $ eval $(opam env) |
| 64 | $ opam install dune ocamlfind zarith lablgtk3-sourceview3 |
| 65 | |
| 66 | should get you a reasonable OCaml environment to compile Rocq. See the |
| 67 | OPAM documentation for more help. |
| 68 | |
| 69 | Nix users can also get all the required dependencies by running: |
| 70 | |
| 71 | $ nix-shell |
| 72 | |
| 73 | Run-time dependencies of native compilation |
| 74 | ------------------------------------------- |
| 75 | |
| 76 | The OCaml compiler and findlib are build-time dependencies, but also |
| 77 | run-time dependencies if you wish to use the native compiler. |
| 78 | |
| 79 | Build and install procedure |
| 80 | --------------------------- |
| 81 | |
| 82 | Note that Rocq supports a faster, but less optimized developer build, |
| 83 | but final users must always use the release build. See |
| 84 | [dev/doc/build-system.dune.md](dev/doc/build-system.dune.md) |
| 85 | for more details. |
| 86 | |
| 87 | To build and install Rocq (and RocqIDE if desired) do: |
| 88 | |
| 89 | $ make dunestrap |
| 90 | $ dune build -p rocq-runtime,coq-core,rocq-core,coqide-server,rocqide |
| 91 | $ dune install --prefix=<install_prefix> rocq-runtime coq-core rocq-core coqide-server rocqide |
| 92 | |
| 93 | You can drop the `rocqide` packages if not needed. |
| 94 | |
| 95 | Packagers may want to play with `dune install` options as to tweak |
| 96 | installation paths, and the `-libdir` argument for `./configure` to tell Rocq |
| 97 | where to find its standard library, (`configure` doesn't control |
| 98 | installation paths these days). See refman "Command-line and graphical tools" |
| 99 | -> "The Rocq Prover commands" -> "System configuration" for more info. |
| 100 | |
| 101 | OCaml toolchain advisory |
| 102 | ------------------------ |
| 103 | |
| 104 | When loading plugins or `vo` files, you should make sure that these |
| 105 | were compiled with the same OCaml setup (version, flags, |
| 106 | dependencies...) as Rocq. Distribution of pre-compiled plugins and |
| 107 | `.vo` files is only possible if users are guaranteed to have the same |
| 108 | Rocq version compiled with the same OCaml toolchain. An OCaml setup |
| 109 | mismatch is the most probable cause for an `Error while loading ...: |
| 110 | implementation mismatch on ...`. |
| 111 | |
| 112 | coq_environment.txt |
| 113 | ------------------- |
| 114 | Rocq binaries which honor environment variables, such as `ROCQLIB`, can |
| 115 | be seeded values for these variables by placing a text file named |
| 116 | `coq_environment.txt` next to them. The file can contain assignments |
| 117 | like `ROCQLIB="some path"`, that is a variable name followed by `=` and |
| 118 | a string that follows OCaml's escaping conventions. This feature can be |
| 119 | used by installers of binary package to make Rocq aware of its installation |
| 120 | path. |