Skip to content

Build LLVM and Clang from source code

Yulei Sui edited this page Jun 28, 2020 · 9 revisions

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

1. Download LLVM-10.0.0, clang-10.0.0
2. Unzip the LLVM and Clang source files

tar xf llvm-10.0.0.src.tar.xz
tar xf clang-10.0.0.src.tar.xz
mv clang-10.0.0.src llvm-10.0.0.src/tools/clang

3. Create your target build folder and make

mkdir llvm-10.0.0.obj
cd llvm-10.0.0.obj
cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../llvm-10.0.0.src (or add "-DCMAKE_BUILD_TYPE:STRING=Debug" for debug version)
make -j8  

4. Add paths for LLVM and Clang

export LLVM_SRC=your_path_to_llvm-10.0.0.src
export LLVM_OBJ=your_path_to_llvm-10.0.0.obj
export LLVM_DIR=your_path_to_llvm-10.0.0.obj
export PATH=$LLVM_DIR/bin:$PATH

5. Build SVF