In some distributions, like Arch Linux, libtinfo.so is compiled as a part of libncurses.so.
As a result, ycmd will not start:
on Arch Linux x86_64 up to date with YCM @ b1bba2e
Traceback (most recent call last):
File "/home/apierlot/.vim/bundle/YouCompleteMe/python/ycm/server/ycmd.py", line 98, in <module>
Main()
File "/home/apierlot/.vim/bundle/YouCompleteMe/python/ycm/server/ycmd.py", line 87, in Main
from ycm.server import handlers
File "/home/apierlot/.vim/bundle/YouCompleteMe/python/ycm/server/../../ycm/server/handlers.py", line 30, in <module>
str( e ) ) )
RuntimeError: Error importing ycm_core. Are you sure you have placed a version 3.2+ libclang.[so|dll|dylib]
in folder "/home/apierlot/.vim/bundle/YouCompleteMe/python"? See the Installation Guide in the docs.
Full error: libtinfo.so.5: cannot open shared object file: No such file or directory
see https://github.com/mozilla/rust/commit/597e96b5493151bb4196b5711548b32c8192aae4 for a possible fix.
I had the same problem and fixed it by install a symlinked version via AUR. But it would be nice if YCM can provide some kind of fallback to libncurses.
I'm guessing libclang links to that lib; if the libclang downloaded by the install script is not good enough on your system, it's up to the user to provide one (compile clang etc).
a solution for gentoo users: re-emerge sys-libs/ncurses with tinfo use flag
@Valloric Why not fix the install.sh script instead? The change is as small as passing one extra argument
I agree with alexandernst. I spent a few hours googling over this issue before I came across this. It would be a great help to us Arch users if we could get a fix for this or at least a heads up.
@alexandernst What exactly needs to be added? I'd love to see a pull request.
@Valloric Adding LLVM_OPTS="$LLVM_OPTS --disable-terminfo" to the build step should fix it, if I haven't misunderstood the bug.
@Valloric I think your original advice (from January) was the best one. I came across this problem, and replacing the downloaded libclang.so with a symlink to /usr/lib/libclang.so solved the issue.
@alexandernst I made this change:
--- a/install.sh
+++ b/install.sh
@@ -14,4 +14,7 @@ if command_exists python2; then
PYTHON_BINARY=python2
fi
+# https://github.com/Valloric/YouCompleteMe/issues/778
+export LLVM_OPTS="$LLVM_OPTS --disable-terminfo"
+
$PYTHON_BINARY "$SCRIPT_DIR/install.py" "$@" || exit $?
and then ran ./install.sh --clang-completer. this did not fix this for me.
Assuming that disabling terminfo works, the option seems to be LLVM_ENABLE_TERMINFO=OFF, but I'm not sure where this should be added. Perhaps somewhere in third_party/ycmd/cpp/ycm/CMakeLists.txt? Is YouCompleteMe actually building LLVM at all?
Is YouCompleteMe actually building LLVM at all?
No it doesn't. We use precompiled version of LLVM from the site. So if you actually need that option you should compile it yourself.
Just upgraded my Arch system and got into this. System's libtinfo now (from AUR) is version 6, and the legacy compatibility package is currently broken at this moment (https://aur.archlinux.org/packages/libtinfo-5). --system-libclang is also not working since current version of Clang for Arch is 3.7.
For reference:
With provided libclang:
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 183, in <module>
Main()
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 158, in Main
extra_conf_store.CallGlobalExtraConfYcmCorePreloadIfExists()
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 73, in CallGlobalExtraConfYcmCorePreloadIfExists
_CallGlobalExtraConfMethod( 'YcmCorePreload' )
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 91, in _CallGlobalExtraConfMethod
module = Load( global_ycm_extra_conf, force = True )
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 149, in Load
module = LoadPythonSource( _RandomName(), module_file )
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/utils.py", line 326, in LoadPythonSource
return imp.load_source( name, pathname )
File "/home/francisco/.ycm_extra_conf.py", line 2, in <module>
import ycm_core
ImportError: libtinfo.so.5: cannot open shared object file: No such file or directory
Reason of error:
(ycm) ~/.v/p/YouCompleteMe ❯❯❯ readelf -d third_party/ycmd/libclang.so.3.8 swift-completer ✱ ◼
Dynamic section at offset 0x279b1b0 contains 37 entries:
Tag Type Name/Value
0x0000000000000003 (PLTGOT) 0x279ffe8
0x0000000000000002 (PLTRELSZ) 7224 (bytes)
0x0000000000000017 (JMPREL) 0x30dd40
0x0000000000000014 (PLTREL) RELA
0x0000000000000007 (RELA) 0x8568
0x0000000000000008 (RELASZ) 3168216 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffff9 (RELACOUNT) 131761
0x0000000000000006 (SYMTAB) 0x260
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000005 (STRTAB) 0x3b60
0x000000000000000a (STRSZ) 14680 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x74b8
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [librt.so.1]
0x0000000000000001 (NEEDED) Shared library: [libtinfo.so.5]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libz.so.1]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
0x000000000000000e (SONAME) Library soname: [libclang.so.3.8]
0x000000000000000c (INIT) 0x30f978
0x000000000000000d (FINI) 0x1c50498
0x000000000000001a (FINI_ARRAY) 0x246d738
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x0000000000000019 (INIT_ARRAY) 0x246d740
0x000000000000001b (INIT_ARRAYSZ) 1656 (bytes)
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib]
0x000000006ffffff0 (VERSYM) 0x7ef8
0x000000006ffffffc (VERDEF) 0x83b8
0x000000006ffffffd (VERDEFNUM) 1
0x000000006ffffffe (VERNEED) 0x83d4
0x000000006fffffff (VERNEEDNUM) 7
0x0000000000000000 (NULL) 0x0
After a --system-libclang installation:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 183, in <module>
Main()
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 158, in Main
extra_conf_store.CallGlobalExtraConfYcmCorePreloadIfExists()
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 73, in CallGlobalExtraConfYcmCorePreloadIfExists
_CallGlobalExtraConfMethod( 'YcmCorePreload' )
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 91, in _CallGlobalExtraConfMethod
module = Load( global_ycm_extra_conf, force = True )
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 149, in Load
module = LoadPythonSource( _RandomName(), module_file )
File "/home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/utils.py", line 326, in LoadPythonSource
return imp.load_source( name, pathname )
File "/home/francisco/.ycm_extra_conf.py", line 2, in <module>
import ycm_core
ImportError: /home/francisco/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/../ycm_core.so: undefined symbol: clang_parseTranslationUnit2FullArgv
Reason of error:
(ycm) ~/.v/p/YouCompleteMe ❯❯❯ pacman -Qs clang swift-completer ✱ ◼
local/bear 2.1.3-1
tool to generate compilation database for clang tooling
extra/clang 3.7.1-1
C language family frontend for LLVM
extra/clang-tools-extra 3.7.1-1
Extra tools built using Clang's tooling APIs
I've found a fix for libtinfo-5 installation problems related to GPG verification. This is the prelude recipe for successful YCM installation (without --system-libclang):
❯❯❯ sudo pacman-key --refresh-keys
❯❯❯ gpg --keyserver pgp.mit.edu --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB
❯❯❯ yaourt -S libtinfo-5
I also have this problem. @oblitum can you please leave a comment on what your three lines are supposed to do? I don't really like to blindly copy paste code from the internet in my command line.
@krux02 well, I more or less just copied and pasted too, and also, I don't like to do that, but they seem reasonably harmless. The first is just an update, the second add a key server I think, but it's on mit.edu, so, seem ok I guess, the other is just to install the old lib. So, all in all, it didn't scare me.
@krux02 you can download the opensuse version prebuilt binary from llvm download page, and compile ycm with it. the opensuse version clang does not need the old libtinfo.
@fplust Ok, I am downloading it at the moment. Do I just need to replace the version in the ycm folder with the downloaded one? Will I have to redo it after each update?
@krux02 you should not replace it, because the install script will check the hash code to make sure the downloaded one is a right one, so you have to follow the Full Installation Guide in readme.
I feel I spend more time fixing issues problems after it break yet again than actually using it productively.
@krux02 exactly what, there're many things here to point out, ArchLinux?, YCM?, Clang? :-D
You may also opt for the former solution, it's a no brainer... Execute the prelude since without it you're unable to get libtinfo-5 from AUR (the solution comes from there). After that, python2 ./install.py --your-completers-here, done.
Well, the guys on AUR are still battling over this, the mit.edu link may have become dead: https://aur.archlinux.org/packages/ncurses5-compat-libs.
Same error on FreeBSD 10.3 with llvm37
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 183, in <module>
Main()
File "/usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 158, in Main
extra_conf_store.CallGlobalExtraConfYcmCorePreloadIfExists()
File "/usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 73, in CallGlobalExtraConfYcmCorePreloadIfExists
_CallGlobalExtraConfMethod( 'YcmCorePreload' )
File "/usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 91, in _CallGlobalExtraConfMethod
module = Load( global_ycm_extra_conf, force = True )
File "/usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/extra_conf_store.py", line 149, in Load
module = LoadPythonSource( _RandomName(), module_file )
File "/usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/utils.py", line 358, in LoadPythonSource
return imp.load_source( name, pathname )
File "/home/Loic/.vim/.ycm_extra_conf.py", line 3, in <module>
import ycm_core
ImportError: /usr/home/Loic/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycm_core.so: Undefined symbol "clang_parseTranslationUnit2FullArgv"
By the way, for me it works now, after I installed libtinfo-5.
Yep, that libtinfo-5 fix works great. Just worked for me from a non-system clang install. (Keepin thread alive for future people)
I've got a similar issue in fedora 24. YCM daemon crashed because it failed to open libtinfo. Installing ncurses-compat-libs package fixed the issue. It looks like fedora 24 comes with libtinfo.so.6 by default, however YCM requires libtinfo.so.5.
@pdavydov108 yep, it seems now the correct way to fix on Arch too is to install the ncurses5-compat-libs. This is a problem with libclang in truth.
It's not a problem with YCM, but with the provided (downloaded) clang. Arch users are better off using --system-libclang.
Yep ncurses5-compat-libs fixed it for me
Solved on Arch after installing ncurses5-compat-libs.
also see this if you got error ERROR: One or more PGP signatures could not be verified! when installing.
On Fedora 24 64bits system, solve libtinfo.so.5 not found error without ncurses5-compat-libs.
because i wouldn't like to install any extra libraries for using YCM.
make a symbolic link for libtinfo.so.5 via libtinfo.so.6
$ sudo ln -s /lib64/libtinfo.so.6.0 /lib64/libtinfo.so.5
then, you can see like below:
lrwxrwxrwx. 1 root root 15 7월 24 02:06 libtinfo.so.5 -> libtinfo.so.6.0
lrwxrwxrwx. 1 root root 15 4월 8 19:33 libtinfo.so.6 -> libtinfo.so.6.0
-rwxr-xr-x. 1 root root 180192 4월 8 19:33 libtinfo.so.6.0
working well.
For gentoo emerge ncurses at slot 5:
emerge -a ncurses:5
And enable tinfo use flag as @rpolasek said
Update: libtinfo-5 is no longer on AUR. Install ncurses5-compat-libs instead.
Adding "--system-libclang" to my ./install.py command fixed this for me on Arch Linux. 4.0.0 clang is the current version available on Arch at the time of writing this.
For Fedora 26 it's:
sudo dnf install clang
./install.py --system-libclang --all
@kevinkjt2000 Thanks! It also worked now for clang version 5.0.0!
How about commit to install.py this part fixed?
@kevinkjt2000 Thanks! Yours is indeed a nicer solution than using AUR libs.
This work on Arch.
python3 install.py --system-libclang --all
Fedora 27, installing ncurses-compat-libs works when not using --system-libclang
On Arch I've solved installing ncurses and then
sudo ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5
Symlinking ABI incompatible shared objects is a terrible idea.
~In Fedora, the command to fix it was:~
~sudo ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5~
For Fedora, just pass the --system-libclang option when running install.py
(./install.py --clang-completer --system-libclang)
Symlinking ABI incompatible shared objects is never a good idea. The only actualy solutions are installing libtinfo.so.5, using the system libclang or building clang from source and using that.
@bstaletic answer is the right answer to this problem. To avoid further confusion, I'm locking this thread. If users have further problems, feel free to raise a new issue.
Most helpful comment
a solution for gentoo users: re-emerge sys-libs/ncurses with tinfo use flag