Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken build with CLANGD_ENABLE_REMOTE #351

Closed
sam-mccall opened this issue Apr 25, 2020 · 2 comments
Closed

Broken build with CLANGD_ENABLE_REMOTE #351

sam-mccall opened this issue Apr 25, 2020 · 2 comments
Assignees

Comments

@sam-mccall
Copy link
Member

-- Version: 0.0.0
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
CMake Error: install(EXPORT "ClangTargets" ...) includes target "clangdRemoteIndex" which requires target "RemoteIndexProtos" that is not in the export set.
CMake Error: install(EXPORT "ClangTargets" ...) includes target "clangdRemoteMarshalling" which requires target "RemoteIndexProtos" that is not in the export set.
CMake Generate step failed.  Build files cannot be regenerated correctly.
ninja: error: rebuilding 'build.ninja': subcommand failed

Apart from the remote/grpc related vars, my cmake setup is:

#!/bin/bash
cmake -G Ninja \
  -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_ASSERTIONS=On \
  -DCMAKE_LINKER=/usr/bin/ld.lld \
  -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld-9 \
  -DCMAKE_C_COMPILER=/usr/bin/clang-9 \
  -DCMAKE_CXX_COMPILER=/usr/bin/clang++-9 \
  -DCMAKE_CXX_FLAGS=-gmlt \
  -DLLVM_CCACHE_BUILD=On \
  -DLLVM_APPEND_VC_REV=Off \
  ~/src/llvm-project/llvm
@kirillbobyrev
Copy link
Contributor

Ahh, I think this has to do with static linking since I use dynamic libraries. We discussed transitive dependencies in CMake this week and I probably did something that doesn't work in static mode. I'll look into this.

@kirillbobyrev
Copy link
Contributor

I tried many approaches, but it essentially comes to replicating some pieces of what add_clang_library is doing. Hence, all the workarounds I did were heavily relying on some of add_clang_library internals and generic LLVM's CMake variables. Since they can change, I think this is too hacky, so the best way is to fix it is to actually use add_clang_library. This is quite unfortunate because it forces Index.proto into a separate directory and makes the subdirectory structure if index/remote even more bizzare, but this still seems like the best solution.

D78885 up for review.

ronlieb pushed a commit to ROCm/amd-llvm-project that referenced this issue May 1, 2020
Summary:
Generated Protobuf library has to be in CLANG_EXPORTS and should also be
installed appropriately. The easiest way to do that is via CMake's
add_clang_library. That unfortunately applies "one directory - one
clang_(library|tool)" policy so .proto files should be in a separate directory
and complicates the layout.

This setup works both in shared and static libs mode.

Resolves: clangd/clangd#351

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D78885
arichardson pushed a commit to arichardson/llvm-project that referenced this issue Jul 2, 2020
Summary:
Generated Protobuf library has to be in CLANG_EXPORTS and should also be
installed appropriately. The easiest way to do that is via CMake's
add_clang_library. That unfortunately applies "one directory - one
clang_(library|tool)" policy so .proto files should be in a separate directory
and complicates the layout.

This setup works both in shared and static libs mode.

Resolves: clangd/clangd#351

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D78885
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
Summary:
Generated Protobuf library has to be in CLANG_EXPORTS and should also be
installed appropriately. The easiest way to do that is via CMake's
add_clang_library. That unfortunately applies "one directory - one
clang_(library|tool)" policy so .proto files should be in a separate directory
and complicates the layout.

This setup works both in shared and static libs mode.

Resolves: clangd/clangd#351

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D78885
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants