Skip to content

Building PhASAR

fabianbs96 edited this page Aug 22, 2019 · 19 revisions

Installing

The bellow steps help you to compile PhASAR on your own, rather than working with one of the pre-built versions of PhASAR. It is recommended to compile it by yourself in order to get more familiar with building process of PhASAR.

You might want to use our installation script bootstrap.sh, which automatically performs the following installation steps (without visualization installation).

In order to install PhASAR, first you require to install its prerequisites and library dependencies. The required libraries and their installation guidance are mentioned in the following.

Prerequisite libraries

ZLIB

LIBCURSES

SQLITE3

BEAR

PYTHON

Doxygen

Graphviz

BOOST

LLVM/Clang

Visualization Installation

To run PhASAR from the web interface additional libraries are required, which need to be installed manually. In the following you can find the required libraries and their installation guide:

PhASAR visualization prerequisite libraries

cURL

Node.js

Yarn

MongoDB Community Edition

All remaining dependencies are managed by the Yarn dependency manager. Resolved dependencies are stored in the yarn.lock file. To install the dependencies run

$ yarn install

from within the vis/ directory.

Installation instruction for an Ubuntu system

In the following, you find a complete guide of PhASAR installation on Ubuntu (16.04) or an Unix-like system. Most of the required dependencies can be installed using the apt package management system.

Installing ZLIB

ZLIB, a lossless data-compresion library:

$ sudo apt-get install zlib1g-dev

Done!

Installing LIBCURSES

LIBCURSES, a terminal control library for constructing text user interfaces:

$ sudo apt-get install libncurses5-dev

Done!

Installing SQLITE3

SQLITE3, a relational database management system:

$ sudo apt-get install sqlite3 libsqlite3-dev

Done!

Installing BEAR

BEAR can just be installed from the Ubuntu sources:

$ sudo apt-get install bear

Done!

Installing PYTHON3

Python3 can be installed using the Ubuntu sources as well:

$ sudo apt-get install python3

Done!

Installing DOXYGEN and GRAPHVIZ (Required for generating the documentation)

Doxygen has built-in support to generate inheritance diagrams for C++ classes. Graphviz, is open source graph visualization software.

In order to generate the documentation, by running 'make doc', you need to install DOXYGEN and GRAPHVIZ using bellow command:

$ sudo apt-get install doxygen graphviz

Done!

Installing BOOST

First you require to download the BOOST source files:

$ wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz

Next the archived file need to be extracted by using:

$ tar xvf boost_1_66_0.tar.gz

Navigate into the directory!

$ cd boost_1_66_0/

The next command, which prepares the compilation process, requires write permission in your system's /usr/local/ directory:

$ ./bootstrap.sh

At the end, the following command install boost in your system:

$ sudo ./b2 install

The bellow address now should contain library files prefixed with 'libboost_':

$ ls /usr/local/lib

Boost directory can be found in the following path:

$ ls /usr/local/include

Done!

Installing LLVM

It is recommended to install LLVM using the installer script install-llvm-*.sh, which can be found in PhASAR project directory /utils. Parametrize it with the number of cores, that shall be used for compilation (more is better), and specify the path in which you want to downloaded and build LLVM. E.g. use

$ ./install-llvm-8.0.0.sh 4 ~/

to build llvm-8.0.0 using 4 cores in your home directory.

Installing cURL

cURL can be installed from the Ubuntu sources using:

$ sudo apt-get install curl

Done!

Installing Node.js

To install Node.js 10 on Debian and Ubuntu based Linux distributions, use the following commands:

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Done!

Installing Yarn

Yarn can be installed using their Debian package repository. First, configure the repository:

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Then:

$ sudo apt-get update && sudo apt-get install yarn

Done!

Installing MongoDB

The bellow command help you to install MongoDB using .deb packages, you have to import the public key used by the package management system:

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

Create a list file for MongoDB (on Ubuntu 16.04):

$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

Then you can simply:

$ sudo apt-get update && sudo apt-get install mongodb-org

Done!

Now, you are done with installing all the dependencies. Last step is PhASAR installation.

Compile PhASAR

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 built on top of PhASAR.

Please be careful and check if errors occur during the compilation. After having a successful compilation run:

$ sudo make install

You may need to follow the bellow instructions, in the case of not having a successful compilation:

First Navigate to external/ directory:

$ cd /phasar/external

Next remove all the files contained in the external/ directory:

rm -rf *

Then, navigate to phasar/ directory and run the following commands. At the end, run the commands, mentioned above in Compile PhASAR section:

cd ..
git submodule init
git submodule update

The bellow command displays PhASAR manual:

$ ./phasar --help

You can use the following optional parameters along with cmake when compiling PhASAR:

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)

A remark on compile time

C++'s long compile time is 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!

Installation instruction for a MacOS system

Mac OS 10.13.1 or higher only ! To install the framework on a Mac, we rely on Homebrew.

The needed packages are:

$ brew install boost
$ brew install python3

To be continued.

Running a test solver

In order to examine the preciseness of installation, please run the bellow command:

$ phasar --module test/build_systems_tests/installation_tests/module.ll -D ifds_solvertest

When you obtain the output, rather than a segmentation fault or an exception terminating the program abnormally, everything works as expected!

Clone this wiki locally