-
Notifications
You must be signed in to change notification settings - Fork 142
Building PhASAR
Phasar can be installed using the installer scripts as explained in the following.
In the following, we would like to give an complete example of how to install Phasar using an Ubuntu or Unix-like system.
Therefore, we provide an installation script. To install Phasar, just navigate to the top-level directory of PhASAR and use the following command:
$ ./bootstrap.sh --install
Note, that you may need superuser permissions for this and require pip
being installed on your system.
If you only want to build PhASAR without installing it, just omit the --install
flag.
Done!
Mac OS 10.13.1 or higher only! To install the framework on a Mac we will rely on Homebrew. (https://brew.sh/)
Please follow the instructions down below.
$ brew install boost
$ brew install python3
# Install llvm version 10
$ brew install llvm
# Setting the paths
# Use LLVM's Clang rather than Apple's Clang compiler
$ export CC=/usr/local/opt/llvm/bin/clang
$ export CXX=/usr/local/opt/llvm/bin/clang++
# Set PATH env variable to /usr/local/opt/llvm/bin
# Go to PhASAR directory run the following commands
$ git submodule init
$ git submodule update
$ mkdir build
$ cd build/
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make -j $(nproc) # or use a different number of cores to compile it
$ sudo make install # if you wish a system-wise installation
In case of problems with the above commands, refer to OS Support>>macOS
A solution is under implementation.
Set the system's variables for the C and C++ compiler to clang:
$ export CC=/usr/local/bin/clang
$ export CXX=/usr/local/bin/clang++
You may need to adjust the paths according to your system. If you cloned PhASAR non-recursively from Github, you need to initialize PhASAR's submodules before building it:
$ git submodule init
$ git submodule update
If you downloaded PhASAR as a compressed release (e.g. .zip or .tar.gz) you can use the init-submodules-release.sh
script that manually clones the required submodules:
$ utils/init-submodules-release.sh
Navigate into the PhASAR directory. The following commands will do the job and compile the PhASAR framework:
$ mkdir build
$ cd build/
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
$ ninja # We heavily recommend to prefer Ninja over Unix Makefiles
$ sudo make install # if you wish to install PhASAR system wide
If you have used the bootstrap.sh
script to install PhASAR, the above steps are already done.
Use them as a reference if you wish to modify PhASAR and recompile it.
After compilation using cmake the following two binaries can be found in the build/ directory:
- tools/phasar-cli/phasar-cli - the PhASAR command-line tool
- tools/example-tool/myphasartool - an example tool that shows how custom tools can be build on top of PhASAR
For more information, see our README.
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!
To test if everything works as expected please run the following command (assuming you successfully built the project and navigated to build/
):
$ tools/phasar-cli/phasar-cli -m test/llvm_test_code/basic/module_cpp.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