Install Clam and make sure that CLAM_INSTALL_DIR/bin
is in your PATH
environment variable or set environment variable CLAM
to CLAM_INSTALL_DIR/bin
, where CLAM_INSTALL_DIR
is the directory where Clam is installed.
Install all the Clam's prerequisites. This is the recipe to install Clam with ldd-boxes and Elina assuming LLVM is installed already in your machine:
git clone https://github.com/seahorn/clam
cd clam
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=_CLAM_INSTALL_DIR_ -DLLVM_DIR=__PATH_TO_LLVM_CONFIG -DCRAB_USE_LDD=ON -DCRAB_USE_ELINA=ON ../
cmake --build . --target extra
cmake --build . --target crab && cmake ..
cmake --build . --target ldd && cmake ..
cmake --build . --target elina && cmake ..
cmake --build . --target install
pip3 install lit
pip3 install OutputCheck
To run all programs from this tutorial just type:
make all
This command will run Clam on each program and it will check (using lit
and OutputCheck
) that the results match the expected ones.
This tutorial includes a standalone LLVM static analyzer that uses the C++ Clam API. The code of the full analyzer is here. To compile the code, follow these two steps:
-
Modify in
api-example/Makefile
the variablesCLAM_INSTALL
,LLVM_HOME
,BOOST_ROOT
,GMP_DIR
, andMPFR_DIR
. -
Type
make
.
cd api-example
./myanalyzer ./bitcode/test3.ll
The directory api-example/bitcode
has several bitcode samples that you can analyze.