File: INSTALL.md

package info (click to toggle)
sail-ocaml 0.19.1%2Bdfsg5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,008 kB
  • sloc: ml: 75,941; ansic: 8,848; python: 1,342; exp: 560; sh: 474; makefile: 218; cpp: 36
file content (127 lines) | stat: -rw-r--r-- 4,690 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# How to install Sail using opam

First, install opam (the OCaml package manager) if you haven't
already. You can use your system's package manager e.g.
`sudo apt-get install opam` (on Ubuntu 20.04) or follow the
[instructions from the opam website](https://opam.ocaml.org/doc/Install.html).
The opam version must be >= 2.0; opam 1 versions are no longer
supported. On older Ubuntu versions such as 18.04 you will not be able
to use opam from the package manager, and will need to install it
following the instructions on the opam website.

Use `ocaml -version` to check your OCaml version. If you have OCaml 4.08.1 or newer, that's fine, otherwise you can use `opam switch` to install a newer version:
```
opam switch create 5.1.0
```
and set up the environment for that OCaml version (note that older versions of opam suggest backticks instead of `$(...)`, but it makes no difference):
```
eval $(opam config env)
```
Install system dependencies, on Ubuntu (if using WSL see the note below):
```
sudo apt-get install build-essential libgmp-dev z3 pkg-config
```
or [MacOS homebrew](https://brew.sh/):
```
xcode-select --install # if you haven't already
brew install gmp z3 pkgconf
```
Finally, install sail from the opam package [https://opam.ocaml.org/packages/sail/](https://opam.ocaml.org/packages/sail/) and its dependencies:
```
opam install sail
```
If all goes well then you'll have sail in your path:
```
which sail
sail --help
```
Some source files that sail uses are found at ``opam config var sail:share`` (e.g. for ``$include <foo.sail>``) but sail should find those when it needs them.

### Note for WSL (Windows subsystem for Linux) users

The version of z3 that ships in the ubuntu repositories can be quite
old, and we've had reports that this can cause issues when using Sail
on WSL. On WSL we recommend downloading a recent z3 release from
https://github.com/Z3Prover/z3/releases rather than installing it via
apt-get.

### Installing development versions of Sail

Released Sail packages lag behind the latest development in the
repository. If you find you need a recently added feature or bug fix
you can use opam pin to install the latest version of Sail from the
repository. Assuming you have previously followed the above
instructions (required to install dependencies):
```
git clone https://github.com/rems-project/sail.git
opam pin add sail
```
will install from a local checkout of the Sail sources.

You can update with new changes as they are committed by pulling and reinstalling:
```
git pull
opam reinstall sail
```

To remove the pin and revert to the latest released opam package type:
```
opam pin remove sail
```

### Building from source (without opam)

Note that if you are just interested in using development versions of Sail, rather than
working the Sail source yourself, the above instructions using opam pin are likely better
suited to your needs.

opam can be used to just install Sail's dependencies. From within the Sail root directory run:
```
opam install . --deps-only
```

Then Sail can be build manually using dune, via
```
dune build --release
dune install
```
or using the provided Makefile that calls the above commands:
```
make install
```

### Some opam information

For full information see the
[opam documentation here](https://opam.ocaml.org/doc/Usage.html). This
section just describes the high level details of what you might need
to know about opam when working with Sail coming from another language
ecosystem.

For the most part opam works like a standard Linux package manager,
such as apt-get (except for OCaml programs and libraries!). `opam
install <package>` installs packages, `opam update` fetches up-to-date
package information from the online opam repository, and `opam
upgrade` upgrades any installed packages.

Where opam differs from some programming language package managers
like `npm` or `cargo` is that packages are installed neither globally
nor on a per-project basis, instead they are installed in
*switches*. A switch has its own OCaml compiler version and set of
libraries and executables. Earlier in this document we created a switch
```
opam switch create 5.1.0
```
but you can create your own switch
```
opam switch create <name> <compiler-version>
```
(if the compiler version is omitted the name is used as the compiler version).

When creating a new switch, or switching between them, use `eval
$(opam env)` to update the current shell environment.

`opam pin` is a very flexible command that allows you to override an
existing package to use a git repository directly, or force a specific
version. It is best explained by the
[documentation here](https://opam.ocaml.org/doc/Usage.html#opam-pin).