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
Inappropriate RUNPATH of clangd binary #1997
Comments
I think this is not a particular issue to clangd, but to every llvm binary built from CMake that ends up getting configured with
I don't see clangd is doing anything wrong: if you put clangd binary somewhere under the system directory e.g. |
@zyn0217 The problem is clangd shouldn't search the working directory(where it is executed) for libraries. |
Honestly, I don't see where the trailing colon gets added from the cmake script. Where did you get your clangd binary? Was that from our github release page? |
I get it from github release. https://github.com/clangd/clangd/releases/download/17.0.3/clangd-linux-17.0.3.zip |
I have searched some documents, and now I believe this is a feature of CMake that helps replace rpaths after installing a target. See this and this. AFAIU, the trailing colons will be added by CMake automatically if the target would get installed and To quickly reproduce such behavior of CMake, one can create the following cmake_minimum_required(VERSION 3.20)
project(testing)
set(_build_rpath "\$ORIGIN/../lib")
add_executable(main main.cpp)
target_compile_options(main PUBLIC "-std=c++17")
set_property(TARGET main APPEND PROPERTY BUILD_RPATH "${_build_rpath}")
install(TARGETS main) int main() {} then running the command
(Note the trailing colon, and it will be gone if we remove the That said, I don't have a better idea of resolving this issue. Configuring LLVM with
|
runpath of the release of clangd is: " $ORIGIN/../lib:"
The colon at the end results in that if any library can't be find at "$ORIGIN/../lib", the program will search current directory. If something like libc.so.6 exists in current directory, clangd will mistakenly try to load it. Like this:(the version of libc.so.6 at current directory is GLIBC_2.35, so there isn't version symbol "GLIBC_2.36")
The situation of using clangd through a plugin in an editor like neovim is similar. Once execute
nvim main.c
, clangd will crash.Logs
Suggest solution
Delete the colon, change the runpath into:
$ORIGIN/../lib
Sorry that I don't know how to modify the runpath of clangd in this project.
System information
Output of
clangd --version
:Editor/LSP plugin: neovim, mason.nvim
Operating system: archlinux
The text was updated successfully, but these errors were encountered: