Build llvm

I have checkedout and built llvm

  1. git clone “https:///”
    2)cmake -DCMAKE_BUILD_TYPE=RELEASE …/llvm
    3)cmake --build .

Now I would like to generate llvm bc and llvm IR
Looks clang is needed for that . but despite compilation clang is not found. Does it mean the is a need to compile twice with

Please take a look at Getting Started with the LLVM System — LLVM 16.0.0git documentation for more details about building LLVM and related projects.

Thanks. I 've built as it is explained there
Still it is not clear. -DLLVM_ENABLE_PROJECTS looks like optional.

You’re not wrong, it is optional. However, when you use the default options you are building just llvm (the target backends, IR processing tools, etc.). Clang itself and anything else is opt in. I know that can be confusing given that there is the “llvm project” and “llvm”.

-DLLVM_ENABLE_PROJECTS="clang" will get you clang, as shown on that linked page.

1 Like