[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

Francesco Petrogalli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 20 07:54:38 PST 2023


fpetrogalli added a comment.

In D141581#4069053 <https://reviews.llvm.org/D141581#4069053>, @tstellar wrote:

> [...]
> It's still not clear to me why LLVM_LINK_COMPONENTS does not work.  Is LLVMTargetParser a library?

Yes, `LLVMTargetParser` is a library built located in `llvm/lib/TargetParser`. `LLVM_LINK_COMPONENTS` does not work if `clangBasic` or  `clangDriver` start building before `LLVMTargetParser`, because the header file `llvm/TargetParser/RISCVTargetParserDefs.inc` has not been generated yet. This didn't happen on my local build, but on some bot I had the following error reported even if `TargetParser` was added to `LLVM_LINK_COMPONENTS`.

<path-to>/llvm-project/llvm/include/llvm/TargetParser/RISCVTargetParser.h:29:10: fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file or directory

  29 | #include "llvm/TargetParser/RISCVTargetParserDef.inc"
     |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By adding `LLVMTargetParser` to the `DEPENDS` of `clangBasic` and `clangDriver` it seems that the order of building LLVMTargetParser before any of the dependents is enforced.

To put in other words, it seems that just specifying` LINK_COMPONENTS = A` for a library `B` allows `A` and `B` to be built in parallel.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141581/new/

https://reviews.llvm.org/D141581



More information about the cfe-commits mailing list