This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix Windows build when remote index is enabled.
ClosedPublic

Authored by ArcsinX on Aug 17 2020, 2:57 AM.

Details

Summary

CMake log:

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:823 (add_executable):
  Target "clangd" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:150 (add_llvm_executable)
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:160 (add_clang_executable)
  D:/llvm-project/clang-tools-extra/clangd/tool/CMakeLists.txt:4 (add_clang_tool)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:821 (add_executable):
  Target "ClangdTests" links to target "Threads::Threads" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:1417 (add_llvm_executable)
  D:/llvm-project/clang-tools-extra/clangd/unittests/CMakeLists.txt:32 (add_unittest)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:527 (add_library):
  Target "RemoteIndexProtos" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
  D:/llvm-project/llvm/cmake/modules/FindGRPC.cmake:105 (add_clang_library)
  D:/llvm-project/clang-tools-extra/clangd/index/remote/CMakeLists.txt:2 (generate_grpc_protos)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:527 (add_library):
  Target "clangdRemoteIndex" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
  D:/llvm-project/clang-tools-extra/clangd/index/remote/CMakeLists.txt:11 (add_clang_library)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:527 (add_library):
  Target "clangdRemoteMarshalling" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
  D:/llvm-project/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
  D:/llvm-project/clang-tools-extra/clangd/index/remote/marshalling/CMakeLists.txt:1 (add_clang_library)

CMake Error at D:/llvm-project/llvm/cmake/modules/AddLLVM.cmake:823 (add_executable):
  Target "clangd-index-server" links to target "Threads::Threads" but the
  target was not found.  Perhaps a find_package() call is missing for an
  IMPORTED target, or an ALIAS target is missing?

Diff Detail

Event Timeline

ArcsinX created this revision.Aug 17 2020, 2:57 AM
ArcsinX requested review of this revision.Aug 17 2020, 2:57 AM
kbobyrev accepted this revision.Aug 17 2020, 6:11 AM

Looks good to me, thank you very much!

I'm curious why this works on Linux though, I guess Threads are not aliased as Threads::Threads somehow?

I assume you are able to build this on Windows with this patch, right? That's really cool, thank you for trying it out! I plan to add Windows support in the following month or so and add some tests so that it is continuously build on the buildbots but I'll need to get a Windows machine first and learn some of its specifics :D

This revision is now accepted and ready to land.Aug 17 2020, 6:11 AM

Looks good to me, thank you very much!

I'm curious why this works on Linux though, I guess Threads are not aliased as Threads::Threads somehow?

I assume you are able to build this on Windows with this patch, right?

Yes.

That's really cool, thank you for trying it out! I plan to add Windows support in the following month or so and add some tests so that it is continuously build on the buildbots but I'll need to get a Windows machine first and learn some of its specifics :D

I have tried the following scenario (index for LLVM project):

  • clangd on Windows
  • clangd-index-server on Linux

It works mostly well, but for obvious reasons I see these messages in clangd-index-server log:

E[11:13:37.051] Unable to convert Symbol to protobuf: File path '/usr/include/wctype.h' doesn't start with '/home/test/work/llvm-project/'.
This revision was automatically updated to reflect the committed changes.