Skip to content

Commit 02919ca

Browse files
authored
Update installation instructions (#602)
* Update INSTALL.md * Update INSTALL.md * Update INSTALL.md
1 parent e9a9b6b commit 02919ca

File tree

1 file changed

+50
-64
lines changed

1 file changed

+50
-64
lines changed

Diff for: INSTALL.md

+50-64
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,18 @@ dependencies:
4242

4343
## From scratch
4444

45-
We recommend using Linux or OSX on a computer with at least 1 GB of memory.
45+
We recommend using Linux or OSX on a computer with at least 4 GB of memory.
4646

4747
On Ubuntu 18.04, the installation process for our C semantics can be summarized as:
4848
```sh
4949
sudo apt-get install --yes \
50-
maven git openjdk-8-jdk flex libgmp-dev \
50+
maven git openjdk-8-jdk flex libgmp-dev libffi-dev \
5151
libmpfr-dev build-essential cmake zlib1g-dev \
52-
libclang-3.9-dev llvm-3.9 diffutils libuuid-tiny-perl \
52+
diffutils libuuid-tiny-perl \
5353
libstring-escape-perl libstring-shellquote-perl \
5454
libgetopt-declare-perl opam pkg-config \
55-
libapp-fatpacker-perl
55+
libapp-fatpacker-perl liblocal-lib-perl \
56+
clang-6.0 libclang-6.0-dev
5657
git clone https://github.com/kframework/c-semantics.git
5758
cd c-semantics
5859
git submodule update --init --recursive
@@ -62,101 +63,78 @@ make -j4 --output-sync=line
6263
```
6364
The build artifacts will be placed inside the `dist` directory.
6465

65-
6666
## Detailed instructions
6767

6868
### 1. Install basic dependencies.
69-
- The GNU C compiler (GCC), Make, diff, and patch. On OSX, these programs are generally part
70-
of XCode. On Ubuntu, these programs are part of the "build-essential" and "diffutils" packages
71-
and can be installed with the following:
72-
```
73-
$ sudo apt-get install build-essential diffutils
69+
- The GNU C compiler (GCC), Make, diff, patch, CMake, Maven, and libraries.
70+
```sh
71+
sudo apt-get install build-essential diffutils bison cmake maven pkg-config \
72+
libgmp-dev libffi-dev libmpfr-dev flex
7473
```
7574
- If using Windows, you'll probably want to install cygwin.
7675

7776
### 2. Install Perl 5 and required modules.
7877
- Perl 5 will likely already be installed on most Linux and Mac OS X machines.
7978
But if not, use your package manager to install it.
8079
- For Windows, see here: <http://www.perl.org/get.html>
81-
- Install the following Perl modules using `cpan` (or `ppm` with ActiveState
82-
Perl in Windows):
80+
- Install the following Perl modules:
8381
- App::FatPacker
8482
- Getopt::Declare
8583
- String::Escape
8684
- String::ShellQuote
8785
- UUID::Tiny
86+
- local::lib
8887

89-
You can also install them using apt-get with
88+
The easiest way is to install them using apt-get:
9089
```
91-
$ sudo apt-get install libuuid-tiny-perl libxml-libxml-perl libgetopt-declare-perl libstring-escape-perl libstring-shellquote-perl libapp-fatpacker-perl
90+
$ sudo apt-get install libuuid-tiny-perl libxml-libxml-perl libgetopt-declare-perl libstring-escape-perl libstring-shellquote-perl libapp-fatpacker-perl liblocal-lib-perl
9291
```
9392

94-
Alternately, to install these modules using cpan:
93+
Alternatively, to install these modules using cpan:
9594
```
96-
$ sudo cpan -i Getopt::Declare String::Escape String::ShellQuote App::FatPacker
95+
$ sudo cpan -i Getopt::Declare String::Escape String::ShellQuote App::FatPacker local::lib
9796
```
98-
### 3. Install K.
99-
- This version of the C semantics should be compatible with the latest version
100-
of Runtime Verification's version of the K Framework (<https://github.com/runtimeverification/k>).
101-
- Ensure `kompile` and `krun` are included in your `$PATH`. For example, if you
102-
downloaded the K Framework to `~/k` (and add this to your `~/.bashrc` to make
103-
this permanent):
104-
```
105-
$ export PATH=$PATH:~/k/bin
97+
98+
### 3. Install OCaml
99+
We use ocaml for the C parser and for K OCaml backend. Install OCaml using
100+
```sh
101+
sudo apt-get install --yes opam
106102
```
107103

108-
### 4. Install OCaml K backend.
109-
- This is a proprietary component used to compile and execute programs written in K.
110-
It is Copyright Runtime Verification, Inc. and subject to the Runtime Verification
111-
Licenses (<https://runtimeverification.com/licensing/>).
112-
A completely free executable version of the C semantics is not available at this time.
113-
From the K source root, you can install it by running:
104+
### 3. Clone the semantics
114105
```
115-
$ mvn dependency:copy -Dartifact=com.runtimeverification.rv_match:ocaml-backend:1.0-SNAPSHOT -DoutputDirectory=k-distribution/target/release/k/lib/java
106+
git clone --depth=1 https://github.com/kframework/c-semantics.git
107+
cd c-semantics
116108
```
117109

118-
### 5. Install OCaml.
119-
- We use a modified version of the C parser from the CIL project, which is
120-
written in OCaml.
121-
- We also now default to using OCaml to execute the C semantics.
122-
123-
For execution the unreleased 4.03 is required, and compiling the semantics
124-
uses ocamlfind to locate require OCaml packages.
125-
This is most easily managed with opam - https://opam.ocaml.org/
126-
To install the required dependencies using OPAM, run
127110

111+
### 4. Install K
112+
An appropriate version of K framework is a submodule of the c-semantics repository.
113+
To build it, first update all the submodules:
128114
```
129-
k-configure-opam-dev
130-
eval `opam config env`
115+
git submodule update --init --recursive
131116
```
132-
133-
To check if OCaml is installed:
117+
then build K:
134118
```
135-
$ ocamlfind ocamlopt -version
136-
Objective Caml version 4.03.0+dev10-2015-07-29
137-
138-
#
119+
pushd .build/k
120+
mvn package -DskipTests -DskipKTest -Dhaskell.backend.skip -Dllvm.backend.skip
121+
```
122+
and install the dependencies of K's OCaml backend:
123+
```
124+
./k-distribution/src/main/scripts/bin/k-configure-opam-dev
125+
popd
126+
eval `opam config env`
139127
```
140128

141-
(Press ctrl-d to exit.)
142-
143-
(For the parser alone versions 3.11, 3.12, and 4.00 all work, probably many
144-
more as well, and no special dependency handling is required.
145-
Installing with your OS package manger or from https://ocaml.org/ will work.
146-
On Ubuntu, `apt-get install ocaml`)
147-
148-
### 6. Download our C semantics.
149-
Use the following command if `git` is installed:
129+
### 5. Install Clang
130+
We use Clang to parse C++ programs. Install Clang 6.0 using
150131
```
151-
$ git clone --depth=1 https://github.com/kframework/c-semantics.git
132+
sudo apt-get install --yes clang-6.0 libclang-6.0-dev
152133
```
153-
Otherwise, download the latest stable version from github here:
154-
<https://github.com/kframework/c-semantics/releases/tag/latest>
155134

156-
### 7. Build our C tool.
157-
- Run `make -j4` in the project root directory.
158-
- This should take roughly 10 minutes on non-windows machines, and up to
159-
60 minutes on windows.
135+
### 6. Build our C tool.
136+
- Run `make` (or `make -j4` if you have enough memory) in the project root directory.
137+
- The build takes about 30 minutes.
160138
- The `make` process creates a `dist/` directory which you can copy elsewhere
161139
to install the C tool, or simply leave it where it is. Either way, you will
162140
probably want to add it to your `$PATH`:
@@ -174,3 +152,11 @@ Hello world
174152
See [README.md](README.md) for a summary of the features supported by the `kcc`
175153
tool.
176154

155+
### 8. Subsequent builds
156+
When building in a fresh shell after all dependencies are installed, before the `make` command, run
157+
```
158+
eval $(opam config env)
159+
eval $(perl -I "~/perl5/lib/perl5" -Mlocal::lib)
160+
```
161+
162+

0 commit comments

Comments
 (0)