Skip to content

Setup Guide (CMake)

Yulei Sui edited this page May 3, 2020 · 30 revisions

Build LLVM and Clang (if you have already done both, just skip it and jump to step 5 to build SVF. )

1. Download LLVM and Clang Pre-Built Binaries Ubuntu 18.04 (For other operating systems, please download corresponding llvm-clang binaries from LLVM download page)

Alternatively, you can also build LLVM and Clang from source code

2. Unzip the downloaded file

tar -xvf clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz

3. Add paths for LLVM and Clang

export LLVM_DIR=your_path_to_clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04
export PATH=$LLVM_DIR/bin:$PATH

Build SVF

4. Download the SVF source code

git clone https://github.com/SVF-tools/SVF.git SVF

5. Build SVF using cmake (Refer to build.sh for details to build release or debug version of SVF)

cd SVF
./build.sh

Or build a debug version of SVF

./build.sh debug

6. Compile a single-file C program to a LLVM bitcode file or compile and link multiple C files using llvm-link. To compile a complicated real-world project you may wish to use WLLVM guide to install it.

clang -c -emit-llvm -g example.c -o example.bc

7. Analyze a llvm bit-code file using SVF