Skip to content

Instantly share code, notes, and snippets.

@rajesh-s
Last active May 31, 2024 19:37
Show Gist options
  • Save rajesh-s/e29f114e2208a00b487b9fb22bb58743 to your computer and use it in GitHub Desktop.
Save rajesh-s/e29f114e2208a00b487b9fb22bb58743 to your computer and use it in GitHub Desktop.
Building LLVM+libomp from scratch
cd && git clone https://github.com/llvm/llvm-project.git
cd llvm-project
sudo apt install cmake
cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="openmp" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/llvm-project/install
ninja -C build -j$(nproc)
ninja -C build install

Usage: clang test.c -o test -fopenmp -rpath ~/llvm-project/install/lib, check if linking fails with ldd test

Note:

  • -rpath is needed on 18.1.6 because a particular PR for the paths to work is only present later llvm/llvm-project#86217
  • On newer versions, -frtlib-add-rpath can be used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment