Install a specific version of llvm

trying to install llvm version 16.0.6 using the -DLLVM_VERSION=16.0.6 flag while configuring the build but it still installs the latest version. Is there something i’m missing here.

If you want to build llvm 16.0.6 from sources you would checkout the git tag for the release, then follow the build instructions as before (these instructions).

<in llvm-project-dir> 
git checkout llvmorg-16.0.6
cd <to your build directory>

Then follow the instructions from there.

You can also use the “Source code” archive from 16.0.6 · Releases · llvm/llvm-project · GitHub instead of a git checkout if you prefer. No tag needed for that just expand the archive and follow the instructions.

(while it is possible to build from the latest llvm sources, and assign it any version number you like, it doesn’t seem like that’s the goal here)

Background in case you were curious what was happening in the build you tried.

LLVM_VERSION is present in our CMake files but it is an internal variable created from LLVM_VERSION_MAJOR/MINOR/PATCH. So likely what happened is in llvm/CMakeLists.txt, LLVM_VERSION was rebuilt from those values overriding your value, and the result is a build of the latest sources reporting the latest version number.

And if you don’t actually need to build from source, there are binary releases at 16.0.6 · Releases · llvm/llvm-project · GitHub too.