-
Notifications
You must be signed in to change notification settings - Fork 142
Building PhASAR
If you would like to compile PhASAR yourself rather than working with one of the pre-built versions of PhASAR, please check the following content for installing the prerequisites and compilation. It is recommended to compile PhASAR yourself in order to get the full C++ experience and to have full control over the build mode.
The installation of PhASAR is not trivial, since it has some library dependencies. The libraries needed in order to be able to compile and run PhASAR successfully are the following.
In the following the authors assume that a Unix-like system is used. Installation guides for the libraries can be found here:
ZLIB - a lossless data-compresion library
LIBCURSES - a terminal control library for constructing text user interfaces.
In the following we would like to give an complete example of how to install PhASAR using an Ubuntu (16.04) or Unix-like system. It that case most dependencies can be installed using the apt package management system.
ZLIB can just be installed from the Ubuntu sources:
$ sudo apt-get install zlib1g-dev
That's it - done.
LIBCURSES can just be installed from the Ubuntu sources:
$ sudo apt-get install libncurses5-dev
Done!
SQLITE3 can just be installed from the Ubuntu sources:
$ sudo apt-get install sqlite3 libsqlite3-dev
That's it - done.
BEAR can just be installed from the Ubuntu sources:
$ sudo apt-get install bear
Done!
Python3 can be installed using the Ubuntu sources as well. Just use the command:
$ sudo apt-get install python3
and you are done.
If you want to generate the documentation running 'make doc' you have to install Doxygen and Graphviz. To install them just use the command:
$ sudo apt-get install doxygen graphviz
Done!
First you have to download the BOOST source files. This can be achieved by:
$ wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
Next the archive file must be extracted by using:
$ tar xvf boost_1_66_0.tar.gz
Jump into the directory!
$ cd boost_1_66_0/
The next command which prepares the compilation process assumes that you have write permission in your system's /usr/local/ directory.
$ ./bootstrap.sh
If no errors occur boost can now be installed using admin permission:
$ sudo ./b2 install
You should be able to find the boost installation on your system now.
$ ls /usr/local/lib
Should output a lot of library files prefixed with 'libboost_'. The result of the command
$ ls /usr/local/include
should contain one directory which is called 'boost'. Congratulations, now you have installed boost.
When installing LLVM your best bet is probably to install it by using the installer script install-llvm-*.sh that can be found in PhASAR project directory utils/. Parameterize it with the number of cores that shall be used for compilation (more is better) and tell it where you would like LLVM to be downloaded and build. E.g. use
$ ./install-llvm-5.0.1.sh 4 ~/
to build llvm-5.0.1 using 4 cores in your home directory.
Navigate into the PhASAR directory. The following commands will do the job and compile the PhASAR framework:
$ mkdir build
$ cd build/
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make -j $(nproc) # or use a different number of cores to compile it
After compilation using cmake the following two binaries can be found in the build/ directory:
- phasar - the actual Phasar command-line tool
- myphasartool - an example tool that shows how tools can be build on top of PhASAR Use the command:
$ ./phasar --help
in order to display the manual and help message.
$ sudo make install
Please be careful and check if errors occur during the compilation.
When using CMake to compile PhASAR the following optional parameters can be used:
Parameter : Type | Effect |
---|---|
BUILD_SHARED_LIBS : BOOL | Build shared libraries (default is OFF) |
CMAKE_BUILD_TYPE : STRING | Build PhASAR in 'Debug' or 'Release' mode (default is 'Debug') |
CMAKE_INSTALL_PREFIX : PATH | Path where PhASAR will be installed if “make install” is invoked or the “install” target is built (default is /usr/local) |
PHASAR_BUILD_DOC : BOOL | Build PhASAR documentation (default is OFF) |
PHASAR_BUILD_UNITTESTS : BOOL | Build PhASAR unittests (default is OFF) |
PHASAR_ENABLE_PAMM : BOOL | Enable the performance measurement mechanism (default is OFF) |
PHASAR_ENABLE_PIC : BOOL | Build Position-Independed Code (default is ON) |
PHASAR_ENABLE_WARNINGS : BOOL | Enable compiler warnings (default is ON) |
C++'s long compile times are always a pain. As shown in the above, when using cmake the compilation can easily be run in parallel, resulting in shorter compilation times. Make use of it!
Mac OS 10.13.1 or higher only ! To install the framework on a Mac we will rely on Homebrew. (https://brew.sh/)
The needed packages are
$ brew install boost
$ brew install python3
To be continued.
To test if everything works as expected please run the following command:
$ phasar --module test/build_systems_tests/installation_tests/module.ll -D ifds_solvertest
If you obtain output other than a segmentation fault or an exception terminating the program abnormally everything works as expected.
- Home
- Reference Material
- Getting Started:
- Building PhASAR
- Using PhASAR with Docker
- A few uses of PhASAR
- Coding Conventions
- Contributing to PhASAR
- Errors and bug reporting
- Update to Newer LLVM Versions
- OS Support