# Build LLVM+TSan
Clone TSan. (The link below is the for the FOCS Lab fork.)
```
git clone https://github.com/focs-lab/llvm-project.git
```
Prerequisites.
```
sudo apt install -y binutils-dev ccache clang cmake ninja-build libstdc++-12-dev
```
CMake. The [flags](https://llvm.org/docs/CMake.html) should be quite straightforward to understand.
```
cmake -S llvm -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;libcxx;libcxxabi;libunwind" -DLIBOMP_OMPT_SUPPORT=ON -DBUILD_SHARED_LIBS=ON -DLLVM_BINUTILS_INCDIR=/usr/include -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DLLVM_TARGETS_TO_BUILD=X86
```
To enable the test suite, add `-DCOMPILER_RT_INCLUDE_TESTS=ON`.
Build.
```
ninja -C build
```
{"title":"Build LLVM+TSan","description":"Clone TSan.","contributors":"[{\"id\":\"b1fe8eb9-27c2-424d-89ec-e4721042b8a2\",\"add\":867,\"del\":29}]"}