admin 管理员组文章数量: 1086019
klee
在安装过程中踩了很多坑,一度让我感到怀疑人生,因此我觉着有必要写一篇博客帮助后来的同学们避坑。
1.准备环境
安装以下依赖:
$ sudo apt-get install build-essential curl libcap-dev git cmake libncurses5-dev python3-minimal python-pip unzip libtcmalloc-minimal4 libgoogle-perftools-dev libsqlite3-dev doxygen
$ pip3 install tabulate wllvm
$ apt install gcc g++
同时也要检查下自己服务器是否安装了cmake。没有就去安装cmake。官方网址:/
2.安装llvm
千万注意!klee2.1只能安装llvm9,安装别的版本会报错! llvm9不能使用apt安装,在这里使用源码安装。
$ git clone .git
$ cd llvm-project/
$ git checkout remotes/origin/release/9.x
$ git branch
$ mkdir build
$ cd build
$ cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm
$ make -j 8
$ make install
注意执行make命令,-j的参数可以根据自己服务器的硬件配置调整。
3.安装约束求解器
$ wget .8.8.zip
$ unzip z3-4.8.8.zip
$ cd z3-4.8.8
$ mkdir build
$ cd build
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
4.安装uclibc和posix运行环境
$ git clone .git
$ cd klee-uclibc
$ ./configure --make-llvm-lib
$ make -j 8
注意:默认情况下,环境中的 clang, llvm-config 都应该是 9.0 版本的,保持一致
5.编译klee
$ wget .1.zip
$ unzip v2.1.zip
$ cd klee-v2.1
$ mkdir build
$ cd build
$ cmake -DENABLE_SOLVER_Z3=ON -DENABLE_POSIX_RUNTIME=ON -DENABLE_KLEE_UCLIBC=ON -DKLEE_UCLIBC_PATH=/home/haoxin/symbolic-execution/klee-uclibc-v1.2 -DLLVM_CONFIG_BINARY=/home/haoxin/corpus-compilers/llvm-9.0/llvm-src/build/bin/llvm-config -DLLVMCC=/home/haoxin/corpus-compilers/llvm-9.0/llvm-src/build/bin/clang -DLLVMCXX=/home/haoxin/corpus-compilers/llvm-9.0/llvm-src/build/bin/clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
$ make -j8
$ make install
注意cmake后面的路径要根据自己服务器安装的路径进行替换
make后可能会出现各种错误,比如:
Can’t find “gperftools/malloc_extension.h”
解决方法:
sudo apt install libunwind8-dev
git clone .git
cd gperftools
sh autogen.sh
./configure
make all
make install
autogen.sh: 3: autoreconf: not found ubuntu
解决办法:
sudo apt-get install -y autoconf automake libtool
/usr/bin/ld: cannot find -lZLIB_LIBRARY-NOTFOUND
解决办法:
$ wget .2.8/zlib-1.2.8.tar.gz/download -o zlib-1.2.8.tar.gz
$ tar zvfx zlib-1.2.8.tar.gz
$ ./configure
$ make
$ make check
$ sudo make install
本文标签: klee
版权声明:本文标题:klee 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1686559662a10276.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论