|
|
To build an llvm toolchain locally including clang, sanitizers and openmp support I did
|
|
|
|
|
|
```
|
|
|
clone https://github.com/llvm/llvm-project.git
|
|
|
cd llvm-project
|
|
|
mkdir build
|
|
|
cd build
|
|
|
cmake -DLLVM_ENABLE_PROJECTS="clang;openmp;compiler-rt" -DLIBOMP_TSAN_SUPPORT=ON -DCMAKE_INSTALL_PREFIX=/temp/timok/llvm -DCMAKE_BUILD_TYPE=Release ../llvm
|
|
|
cmake --build . -j 64
|
|
|
make -j64 install
|
|
|
```
|
|
|
|
|
|
The `CMAKE_INSTALL_PREFIX` has to be set to wherever you want to install the llvm toolchain.
|
|
|
After installing it there `clang` can be found under `CMAKE_INSTALL_PREFIX/bin/clang++`.
|
|
|
To build your application with thread sanitizer add in `CMakeLists.txt`
|
|
|
```
|
|
|
target_compile_options(test_tabulation PRIVATE -fsanitize=thread)
|
|
|
target_link_options(test_tabulation PRIVATE -fsanitize=thread)
|
|
|
```
|
|
|
|
|
|
When running programs with thread sanitizer additional run
|
|
|
|
|
|
```
|
|
|
export TSAN_OPTIONS="ignore_noninstrumented_modules=1"
|
|
|
```
|
|
|
to avoid false positives. More option described here: https://github.com/llvm/llvm-project/tree/main/openmp/tools/archer |
|
|
\ No newline at end of file |