Build LLVM and Clang from source code - SVF-tools/SVF GitHub Wiki

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

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

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

3. Create your target build folder and make

mkdir llvm-16.0.0.obj
cd llvm-16.0.0.obj
cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../llvm-16.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-16.0.0.src
export LLVM_OBJ=your_path_to_llvm-16.0.0.obj
export LLVM_DIR=your_path_to_llvm-16.0.0.obj
export PATH=$LLVM_DIR/bin:$PATH

5. Build SVF