[PATCH] D110318: [Support] Restore LLVMTestingSupport as an llvm component library

Itay Bookstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 09:01:55 PDT 2021


nextsilicon-itay-bookstein added a comment.

My only lead for this change was that I'd assumed that at some point this code did not emit the aforementioned warning: https://github.com/llvm/llvm-project/blob/811b1736d91b301f59fbaa148ff55c32f90a3947/compiler-rt/cmake/Modules/CompilerRTUtils.cmake#L346-L352

Investigating why the command failed, I saw that executing it manually I'd get "llvm-config: unknown component name: testingsupport".
In the `llvm-config` code, this happens when the string supplied (in this case, "testingsupport"), does not appear as a key in the component map: https://github.com/llvm/llvm-project/blob/933e2469a2a8ad2b264f9e64c86a2f6c6e6128af/llvm/tools/llvm-config/llvm-config.cpp#L185

This led me to believe that it has to be a component, or the code in the compiler-rt standalone build has to find the library in some other way (not llvm-config).
This is because only items in `LLVM_COMPONENT_LIBS` are added to the `AvailableComponents` array which generates the dictionary.

I don't see any existing `add_llvm_component_library` with BUILDTREE_ONLY though, so the code in CompilerRTUtils.cmake might all be a bit of a contradiction...
Then again, I see that the `struct AvailableComponent` has a `bool IsInstalled` field, but it's always `true`: https://github.com/llvm/llvm-project/blob/e6e29831ddf8bb8ec03472fe69eea91dcc942124/llvm/cmake/modules/LLVM-Build.cmake#L69

Perhaps that line should set `IsInstalled = !BUILDTREE_ONLY`?

In D110318#3039943 <https://reviews.llvm.org/D110318#3039943>, @tstellar wrote:

> A component library means is one that gets included into libLLVM.so see https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/AddLLVM.cmake#L431
>
> Since this is more of an internal LLVM helper library, I don't think it should be included in libLLVM.so.
>
> To solve your problem I think you just need to drop BUILDTREE_ONLY to install the library.  At least for Fedora we manually install the library, because it's required by clang to run the tests.

Note that the comment there says "candidate for inclusion", I wonder if in the past there were conditions under which it didn't get included into libLLVM.so.

Also, I tried what you suggested; If I keep it as a non-component, and remove the BUILDTREE_ONLY flag, I get this:

  CMake Error: install(EXPORT "LLVMExports" ...) includes target "LLVMTestingSupport" which requires target "gtest" that is not in any export set.

I removed the BUILDTREE_ONLY from gtest as well, but then I get:

  CMake Error in utils/unittest/CMakeLists.txt:
    Target "gtest" INTERFACE_INCLUDE_DIRECTORIES property contains path:
  
      "/local/users/itay/Projects/next-llvm-project/llvm/utils/unittest/googletest/include"
  
    which is prefixed in the source directory.




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110318



More information about the llvm-commits mailing list