vim-lsp-settings icon indicating copy to clipboard operation
vim-lsp-settings copied to clipboard

clangd install failed on debian 10 (./clangd: error while loading shared libraries: libz3.so.4.8: cannot open shared object file: No such file or directory)

Open fcying opened this issue 4 years ago • 14 comments

I test install libz3-dev, but it can't work also.

:LspInstallServer
mkdir: cannot create directory ‘../servers/clangd’: No such file or directory
  2 Downloading clangd and LLVM...
  3   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  4                                  Dload  Upload   Total   Spent    Left  Speed
  5 100  383M  100  383M    0     0  1222k      0  0:05:21  0:05:21 --:--:-- 1330k
  6 Extracting archive...
  7 ./clangd: error while loading shared libraries: libz3.so.4.8: cannot open shared object file: No such file or directory

fcying avatar Jan 06 '20 07:01 fcying

This seems to be known issue. You may want to install libz3.

https://github.com/mattn/vim-lsp-settings/pull/41

mattn avatar Jan 06 '20 07:01 mattn

debian 10 only have libz3-4 libz3-cil libz3-dev, I install both of them, still no work.

fcying avatar Jan 06 '20 07:01 fcying

Thanks your useful informations.

@thomasfaingnaert can you handle this issue?

mattn avatar Jan 06 '20 08:01 mattn

You can try something like:

sudo apt install -y libz3-4
sudo update-alternatives --install /lib/x86_64-linux-gnu/libz3.so.4.8 libz3.4.8 /lib/x86_64-linux-gnu/libz3.so.4 100

But I'm guessing that will shift the problem to another dependency.

cd /path/to/vim-lsp-settings/servers/clangd
ldd ./clangd

will display which dependencies you're still missing.

@mattn It's unfortunate that LLVM doesn't provide releases for generic Linux which include all required libs. Might be better to only enable clangd if the OS is Ubuntu/Mac OS?

thomasfaingnaert avatar Jan 06 '20 21:01 thomasfaingnaert

What if just have a echo that says make sure your distro has the libz3 library installed in order to extract clang.

Another approach is something g like how unzip.exe is used. Ship a snap version of unzip that supports libz3.

prabirshrestha avatar Jan 07 '20 02:01 prabirshrestha

libz3 seems different package. zlib1g-dev is right?

mattn avatar Jan 09 '20 09:01 mattn

You can try something like:

sudo apt install -y libz3-4
sudo update-alternatives --install /lib/x86_64-linux-gnu/libz3.so.4.8 libz3.4.8 /lib/x86_64-linux-gnu/libz3.so.4 100

But I'm guessing that will shift the problem to another dependency.

cd /path/to/vim-lsp-settings/servers/clangd
ldd ./clangd

will display which dependencies you're still missing.

@mattn It's unfortunate that LLVM doesn't provide releases for generic Linux which include all required libs. Might be better to only enable clangd if the OS is Ubuntu/Mac OS?

it also need GLIBC_2.29.

sudo update-alternatives --install /lib/x86_64-linux-gnu/libz3.so.4.8 libz3.4.8 /lib/x86_64-linux-gnu/libz3.so.4 100

ldd ./clangd
./clangd: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./clangd)

I am using homebrew's clang now, it version also is clang9

fcying avatar Jan 13 '20 03:01 fcying

How about to use clang+llvm-9.0.0-x86_64-pc-linux-gnu.tar.xz instead of tarball on ubuntu?

mattn avatar Jan 30 '20 10:01 mattn

you need to install z3 on arch to pass this error.

tmpm697 avatar Feb 09 '20 15:02 tmpm697

I got same error on Debian 10. After I run

$ sudo apt install libz3-4 libz3-cil libz3-dev
$ sudo apt install -y libz3-4
$ sudo update-alternatives --install /lib/x86_64-linux-gnu/libz3.so.4.8 libz3.4.8 /lib/x86_64-linux-gnu/libz3.so.4 100
$ cd /path/to/clangd
$ ldd ./clangd
# No errors

Then :LspInstallServer install without any problem

paraduxos avatar May 03 '20 09:05 paraduxos

For arch linux I had to use the following command.

 sudo pacman -Sy libz3

prabirshrestha avatar May 16 '20 19:05 prabirshrestha

How about to use https://github.com/clangd/clangd? It don't have any dependencies.

fcying avatar Jun 07 '20 11:06 fcying

sudo update-alternatives --install /lib/x86_64-linux-gnu/libz3.so.4.8 libz3.4.8 /lib/x86_64-linux-gnu/libz3.so.4 100

This worked for me. I ran :LspInstallServer after running the code above, and the server was installed correctly. I knew that libz3.so.4 already existed on my system because I found it using sudo find / -xdev -name 'libz3*'.

Luis-Licea avatar May 12 '21 03:05 Luis-Licea

I'm using Debian 11 now.But it works for me. /usr/lib/x86_64-linux-gnu$sudo ln -s libz3.so.4 libz3.so.4.8 Therefore,I think now filename cause this problem. Before,You should run $whereis libz3.so.4 and You should know where is libz3.so.4 in your computer. I'm beginner in linux and I'm Japanese so I maybe wrote wrong.

Smearble avatar Jan 06 '22 03:01 Smearble