clang-tblgen not installed

Hi,

Is there a reason why clang-tblgen is not installed with all of the
other clang binaries?

According to
http://releases.llvm.org/8.0.0/docs/HowToCrossCompileLLVM.html
clang-tblgen (along with llvm-tblgen) are needed if you want to
cross-compile clang, but since clang-tblgen is not installed during the
normal installation process this means that system packages (like those
available for Arch Linux) don't provide a clang-tblgen requiring me to
build a local clang that I can then use to cross-compile clang. This is
at odds with LLVM which does install llvm-tblgen.

Is this a bug, or is there a reason why clang-tblgen is not installed?

Kind regards,
Alex

clang-tblgen is only used as part of the process of building clang itself, and is tied to the revision of clang that it was built as part of. If you’re building a custom clang binary, you should build a clang-tblgen binary yourself from the same sources that you’re using to build the rest of clang. A preinstalled version from a (potentially) different revision of clang should not be expected to work. As such, I don’t think it’s appropriate to install clang-tblgen.

The story for llvm-tblgen is a bit different: that should be part of the development package for LLVM, and installed when the LLVM headers are installed (not when the LLVM binaries are installed). The reason is that out-of-tree backends for LLVM will want to invoke llvm-tblgen on out-of-tree .td files, in order to generate portions of the code for those backends. There is no comparable reason to want clang-tblgen installed – even code using clang as a library, and using clang’s C++ API rather than the C API, has no need of clang-tblgen (assuming that the generated headers are shipped as part of the development package, which they should be).