安装klee 系统ubuntu14.04 64位 llvm2.9
1.安装依赖
sudo apt-get install g++ python curl cmake git bison flex bc libcap-dev
sudo apt-get install minisat
$ export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
$ export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-gnu
2.安装llvm2.9
cd ~
mkdir work
cd work
下载 llvm-gcc4.2-2.9-x86_64-linux.tar
解压生成 llvm-gcc4.2-2.9-x86_64-linux
echo "export PATH=\$PATH:~/work/llvm-gcc4.2-2.9-x86_64-linux/bin" >> ~/.bashrc
source ~/.bashrc
下载llvm-2.9
$ tar zxvf llvm-2.9.tgz
$ cd llvm-2.9
$ ./configure --enable-optimized --enable-assertions
$ make
出现错误Intercept.cpp:69:67:error'lseek64' was not declaredin this scope
/bin/rm:cannot remove '/llvm-2.9/ExecutionEngine/JIT/Releasr+Asserts/Intercept.d.tmp': no such file or directory
解决方法:在llvm-2.9/lib/ExecutionEngine/JIT/Intercept.cpp中加入#include<unistd.h>
在#include<sys/stat.h>和#endif之间
重新$ ./configure --enable-optimized --enable-assertions ,make编译通过
3.安装STP
$ git clone https://github.com/stp/minisat.git
$ cd minisat
$ mkdir build
$ cd build
$ cmake ../
$ make
$ sudo make install
$ git clone https://github.com/stp/stp.git
tar xzfv 2.1.0.tar.gz
$ cd stp-2.1.0
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
$ ulimit -s unlimited
4.可选
uclibc and the POSIX environment model
$ git clone https://github.com/klee/klee-uclibc.git
$ cd klee-uclibc
$ ./configure --make-llvm-lib
$ make -j2
$ cd ..
5.安装klee
$ git clone https://github.com/klee/klee.git
./configure --with-llvm=full-path-to-llvm --with-stp=full-path-to-stp/build --with-uclibc=full-path-to-klee-uclibc --enable-posix-runtime
注意,安装路径为自己的路径
$ make ENABLE_OPTIMIZED=1
6.检测安装
$ make check
$ make unittests
测试时,运行命令
klee get_sign.o
时出现错误
stp: error while loading shared libraries: libstp.so.2.1: cannot open shared object file: No such file or directory
cmake -DENABLE_PYTHON_INTERFACE:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF ..
在klee的Makefile.common中做以下修改