2011-05-11 21:13:55 +08:00
|
|
|
What architecture?
|
|
|
|
------------------
|
|
|
|
|
2015-10-05 23:49:47 +08:00
|
|
|
CPROVER now needs a C++11 compliant compiler and works in the following
|
|
|
|
environments:
|
2011-07-14 19:47:56 +08:00
|
|
|
|
2011-05-11 21:13:55 +08:00
|
|
|
- Linux
|
2011-07-14 19:47:56 +08:00
|
|
|
|
2011-05-11 21:13:55 +08:00
|
|
|
- MacOS X
|
2011-07-14 19:47:56 +08:00
|
|
|
|
2014-06-16 21:42:10 +08:00
|
|
|
- Solaris 11
|
|
|
|
|
2017-03-19 06:13:05 +08:00
|
|
|
- FreeBSD 11
|
2014-11-22 20:46:10 +08:00
|
|
|
|
2011-08-10 20:11:34 +08:00
|
|
|
- Cygwin
|
2017-03-19 06:13:05 +08:00
|
|
|
(We recommend the i686-pc-mingw32-g++ cross compiler, version 5.4 or above.)
|
2011-07-14 19:47:56 +08:00
|
|
|
|
2016-08-15 21:46:58 +08:00
|
|
|
- Microsoft's Visual Studio version 12 (2013), version 14 (2015),
|
|
|
|
or version 15 (older versions won't work)
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2012-10-21 19:15:17 +08:00
|
|
|
The rest of this document is split up into three parts: compilation on
|
|
|
|
Linux, MacOS, Windows. Please read the section appropriate for your
|
|
|
|
machine.
|
2011-05-11 21:13:55 +08:00
|
|
|
|
|
|
|
|
2012-10-21 19:15:17 +08:00
|
|
|
COMPILATION ON LINUX
|
|
|
|
--------------------
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2013-12-11 23:03:32 +08:00
|
|
|
We assume that you have a Debian/Ubuntu or Red Hat-like distribution.
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2011-06-13 20:47:32 +08:00
|
|
|
0) You need a C/C++ compiler, Flex and Bison, and GNU make.
|
2017-03-19 06:13:05 +08:00
|
|
|
The GNU Make needs to be version 3.81 or higher.
|
|
|
|
On Debian-like distributions, do
|
2011-06-13 20:47:32 +08:00
|
|
|
|
2017-05-23 00:35:10 +08:00
|
|
|
apt-get install g++ gcc flex bison make git libwww-perl patch
|
2011-06-13 20:47:32 +08:00
|
|
|
|
2014-10-14 20:14:34 +08:00
|
|
|
On Red Hat/Fedora or derivates, do
|
2013-12-11 20:07:06 +08:00
|
|
|
|
2017-03-23 18:31:24 +08:00
|
|
|
yum install gcc gcc-c++ flex bison perl-libwww-perl patch devtoolset-6
|
2013-12-11 20:07:06 +08:00
|
|
|
|
2017-04-25 17:09:31 +08:00
|
|
|
Note that you need g++ version 4.9 or newer.
|
2016-12-15 02:39:53 +08:00
|
|
|
|
2014-12-08 19:39:31 +08:00
|
|
|
1) As a user, get the CBMC source via
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
git clone https://github.com/diffblue/cbmc cbmc-git
|
2014-12-08 19:39:31 +08:00
|
|
|
|
2017-05-23 00:35:10 +08:00
|
|
|
2) On Debian or Ubuntu, do
|
2017-03-30 01:39:52 +08:00
|
|
|
|
|
|
|
cd cbmc-git/src
|
|
|
|
make minisat2-download
|
|
|
|
make
|
|
|
|
|
2017-03-23 16:50:03 +08:00
|
|
|
On Redhat/Fedora etc., do
|
|
|
|
|
|
|
|
cd cbmc-git/src
|
|
|
|
make minisat2-download
|
2017-03-23 18:31:24 +08:00
|
|
|
scl enable devtoolset-6 bash
|
|
|
|
make
|
2017-03-23 16:50:03 +08:00
|
|
|
|
2013-12-11 23:03:32 +08:00
|
|
|
|
|
|
|
COMPILATION ON SOLARIS 11
|
|
|
|
-------------------------
|
|
|
|
|
2014-02-22 03:36:51 +08:00
|
|
|
1) As root, get the necessary development tools:
|
|
|
|
|
2016-07-20 23:23:07 +08:00
|
|
|
pkg install system/header developer/lexer/flex developer/parser/bison developer/versioning/git
|
2017-04-02 19:15:25 +08:00
|
|
|
pkg install --accept developer/gcc/gcc-c++-5
|
2014-02-22 03:36:51 +08:00
|
|
|
|
2014-06-16 21:42:10 +08:00
|
|
|
2) As a user, get the CBMC source via
|
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
git clone https://github.com/diffblue/cbmc cbmc-git
|
2014-06-16 21:42:10 +08:00
|
|
|
|
|
|
|
3) Get MiniSat2 by entering
|
2013-12-11 23:03:32 +08:00
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
cd cbmc-git
|
2016-03-09 01:26:34 +08:00
|
|
|
wget http://ftp.debian.org/debian/pool/main/m/minisat2/minisat2_2.2.1.orig.tar.gz
|
|
|
|
gtar xfz minisat_2.2.1.orig.tar.gz
|
2016-07-20 23:23:07 +08:00
|
|
|
mv minisat2-2.2.1 minisat-2.2.1
|
2016-03-09 01:26:34 +08:00
|
|
|
(cd minisat-2.2.1; patch -p1 < ../scripts/minisat-2.2.1-patch)
|
2013-12-11 23:03:32 +08:00
|
|
|
|
2014-06-16 21:42:10 +08:00
|
|
|
4) Type
|
2013-12-11 23:03:32 +08:00
|
|
|
|
2016-07-20 23:23:07 +08:00
|
|
|
cd src; gmake
|
|
|
|
|
|
|
|
That should do it. To run, you will need
|
2014-02-22 03:36:51 +08:00
|
|
|
|
2016-07-20 23:23:07 +08:00
|
|
|
export LD_LIBRARY_PATH=/usr/gcc/4.9/lib
|
2013-12-11 23:03:32 +08:00
|
|
|
|
2012-10-21 19:15:17 +08:00
|
|
|
|
2017-03-19 06:13:05 +08:00
|
|
|
COMPILATION ON FREEBSD 11
|
|
|
|
-------------------------
|
2014-11-22 20:46:10 +08:00
|
|
|
|
|
|
|
1) As root, get the necessary tools:
|
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
pkg install bash gmake git www/p5-libwww patch flex bison
|
2014-11-22 20:46:10 +08:00
|
|
|
|
|
|
|
2) As a user, get the CBMC source via
|
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
git clone https://github.com/diffblue/cbmc cbmc-git
|
2014-11-22 20:46:10 +08:00
|
|
|
|
|
|
|
3) Do
|
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
cd cbmc-git/src
|
2014-11-22 20:46:10 +08:00
|
|
|
|
2015-01-24 22:59:50 +08:00
|
|
|
4) Do
|
2014-11-22 20:46:10 +08:00
|
|
|
|
|
|
|
gmake minisat2-download
|
|
|
|
gmake
|
|
|
|
|
|
|
|
|
2012-10-21 19:15:17 +08:00
|
|
|
COMPILATION ON MACOS X
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
Follow these instructions:
|
|
|
|
|
|
|
|
0) You need a C/C++ compiler, Flex and Bison, and GNU make. To this
|
2016-01-13 03:50:20 +08:00
|
|
|
end, first install the XCode from the App-store and then type
|
2012-10-21 19:15:17 +08:00
|
|
|
|
2016-01-13 03:50:20 +08:00
|
|
|
xcode-select --install
|
2012-10-21 19:15:17 +08:00
|
|
|
|
2016-01-13 03:50:20 +08:00
|
|
|
in a terminal window.
|
|
|
|
|
|
|
|
1) Then get the CBMC source via
|
2012-10-21 19:15:17 +08:00
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
git clone https://github.com/diffblue/cbmc cbmc-git
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2014-12-08 19:39:31 +08:00
|
|
|
2) Then type
|
|
|
|
|
2016-04-03 00:18:30 +08:00
|
|
|
cd cbmc-git/src
|
2014-12-08 19:39:31 +08:00
|
|
|
make minisat2-download
|
|
|
|
make
|
2012-10-21 19:15:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
COMPILATION ON WINDOWS
|
|
|
|
----------------------
|
|
|
|
|
2012-11-15 16:35:16 +08:00
|
|
|
There are two options: compilation using g++ from Cygwin, or using
|
|
|
|
Visual Studio's compiler. As Cygwin has significant overhead during
|
|
|
|
process creation, we advise you use Visual Studio.
|
|
|
|
|
2012-10-21 19:15:17 +08:00
|
|
|
Follow these instructions:
|
|
|
|
|
|
|
|
0) You need a C/C++ compiler, Flex and Bison, GNU tar, gzip2,
|
2013-06-10 22:02:59 +08:00
|
|
|
GNU make, and patch. The GNU Make needs to be version 3.81 or
|
2013-05-15 19:48:39 +08:00
|
|
|
higher. If you don't already have the above, we recommend you install
|
|
|
|
Cygwin.
|
2012-10-21 19:15:17 +08:00
|
|
|
|
|
|
|
1) You need a SAT solver (in source). We recommend MiniSat2. Using a
|
|
|
|
browser, download from
|
|
|
|
|
2016-05-19 19:54:46 +08:00
|
|
|
http://ftp.debian.org/debian/pool/main/m/minisat2/minisat2_2.2.1.orig.tar.gz
|
2012-10-21 19:15:17 +08:00
|
|
|
|
|
|
|
and then unpack with
|
|
|
|
|
2016-03-09 01:26:34 +08:00
|
|
|
tar xfz minisat-2.2.1.tar.gz
|
|
|
|
mv minisat minisat-2.2.1
|
|
|
|
cd minisat-2.2.1
|
|
|
|
patch -p1 < ../scripts/minisat-2.2.1-patch
|
2012-10-21 19:15:17 +08:00
|
|
|
|
2013-05-15 19:48:39 +08:00
|
|
|
The patch removes the dependency on zlib and prevents a problem
|
|
|
|
with a header file that is often unavailable on Windows.
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2017-04-02 19:15:25 +08:00
|
|
|
2A) To compile with Cygwin, install the mingw compilers, and adjust
|
2012-10-21 19:15:17 +08:00
|
|
|
the second line of config.inc to say
|
|
|
|
|
|
|
|
BUILD_ENV = MinGW
|
|
|
|
|
2017-04-02 19:15:25 +08:00
|
|
|
2B) To compile with Visual Studio, make sure you have at least Visual
|
2016-08-15 21:46:58 +08:00
|
|
|
Studio version 12 (2013), and adjust the second line of config.inc to say
|
2011-07-14 19:47:56 +08:00
|
|
|
|
2012-10-21 19:15:17 +08:00
|
|
|
BUILD_ENV = MSVC
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2017-04-02 19:15:25 +08:00
|
|
|
Open the Visual Studio Command prompt, and then bash.exe -login from
|
|
|
|
Cygwin from in there.
|
|
|
|
|
|
|
|
3) Type cd src; make - that should do it.
|
2011-05-11 21:13:55 +08:00
|
|
|
|
2013-03-04 18:02:33 +08:00
|
|
|
|
2013-06-16 23:14:44 +08:00
|
|
|
(Optional) A Visual Studio project file can be generated with the script
|
|
|
|
"generate_vcxproj" that is in the subdirectory "scripts". The project file
|
2013-06-24 03:25:46 +08:00
|
|
|
is helpful for GUI-based tasks, e.g., the class viewer, debugging, etc., and
|
|
|
|
can be used for building with MSBuild. Note that you still need to run
|
|
|
|
flex/bison using "make generated_files" before opening the project.
|
2014-10-31 02:33:40 +08:00
|
|
|
|
|
|
|
|
2014-12-08 19:39:31 +08:00
|
|
|
WORKING WITH ECLIPSE
|
|
|
|
--------------------
|
2014-10-31 02:33:40 +08:00
|
|
|
|
|
|
|
To work with Eclipse, do the following:
|
|
|
|
|
|
|
|
1) Select File -> New -> Makefile Project with Existing Code
|
|
|
|
|
|
|
|
2) Type "cprover" as "Project Name"
|
|
|
|
|
|
|
|
3) Select the "src" subdirectory as "Existing Code Location"
|
|
|
|
|
|
|
|
4) Select a toolchain appropriate for your platform
|
|
|
|
|
|
|
|
5) Click "Finish"
|
|
|
|
|
|
|
|
6) Select Project -> Build All
|
|
|
|
|
|
|
|
|
2017-01-04 21:36:14 +08:00
|
|
|
CODE COVERAGE
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Code coverage metrics are provided using gcov and lcov. Ensure that you
|
|
|
|
have installed lcov from http://ltp.sourceforge.net/coverage/lcov.php
|
|
|
|
note for ubuntu lcov is available in the standard apt-get repos.
|
|
|
|
|
|
|
|
To get coverage metrics run the following script from the regression
|
|
|
|
directory:
|
|
|
|
|
|
|
|
get_coverage.sh
|
|
|
|
|
|
|
|
This will:
|
|
|
|
1) Rebuild CBMC with gcov enabled
|
|
|
|
2) Run all the regression tests
|
|
|
|
3) Collate the coverage metrics
|
|
|
|
4) Provide an HTML report of the current coverage
|