首页 > VIM > linux安装vim插件ycm出现链接失败问题

linux安装vim插件ycm出现链接失败问题

2021年11月14日 发表评论 阅读评论 4204次阅读    

由于之前各种胡乱安装插件,到最后YCM出问题,每次打开vim都报错:

YouCompleteMe unavailable: /usr/local/lib/python3.9/lib-dynload/_socket.cpython-39-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type

后来通过重装vim解决。但还是报新错误:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected error while loading the YCM core library. Type ':YcmToggleLogs ycmd_13159_stderr_m816isyd.log' to check the logs.

于是输入命令看具体错误内容::YcmToggleLogs ycmd_13159_stderr_m816isyd.log, 内容如下:

1 2021-11-14 20:02:29,271 - ERROR - /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version CXXABI_1.3.11' not found (required by /data00/home/#.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ ycmd/ycm_core.cpython-39-x86_64-linux-gnu.so)
1 Traceback (most recent call last):
2 File "/data00/home/#.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 502, in ImportAndCheckCore
3 ycm_core = ImportCore()
4 File "/data00/home/#.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 493, in ImportCore
5 import ycm_core as ycm_core
6 ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
CXXABI_1.3.11' not found (required by /data00/home/#.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.cpython -39-x86_64-linux-gnu.so)
7
8 During handling of the above exception, another exception occurred:
9
10 Traceback (most recent call last):
11 File "/data00/home/¥.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 505, in ImportAndCheckCore
12 ycm_core = ImportCore()
13 File "/data00/home/#.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/utils.py", line 493, in ImportCore
14 import ycm_core as ycm_core
15 ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /data00/home/#.0/kulvenv/vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.cpython -39-x86_64-linux-gnu.so)

看着似乎是链接库的问题。于是全局搜索:
find / -name "libstdc++.so.*"
找到可能正确的新版本libc库,应该是这个;
/usr/local/lib64/libstdc++.so.6.0.25
记录一下上下文:
- 当前的链接如下:
ll /usr/lib/x86_64-linux-gnu/libstdc++.so.6
lrwxrwxrwx 1 root root 19 Feb 15 2018 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -> libstdc++.so.6.0.22

  • 线上有个25版本最新的:
    ll /usr/local/lib64/libstdc++.so.6
    lrwxrwxrwx 1 root staff 19 Nov 3 08:58 /usr/local/lib64/libstdc++.so.6 -> libstdc++.so.6.0.25

于是确认新版本的版本号:

strings /usr/local/lib64/libstdc++.so.6| grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_1.3.8
CXXABI_1.3.9
CXXABI_1.3.10
CXXABI_1.3.11
CXXABI_TM_1
CXXABI_FLOAT128
CXXABI_1.3
CXXABI_1.3.11
CXXABI_1.3.2
CXXABI_1.3.6
CXXABI_FLOAT128
CXXABI_1.3.9
CXXABI_1.3.1
CXXABI_1.3.5
CXXABI_1.3.8
CXXABI_1.3.4
CXXABI_TM_1
CXXABI_1.3.7
CXXABI_1.3.10
CXXABI_1.3.3

没问题,有CXXABI_1.3.11 , 于是修改软连接试试:

root@x:~# ll /usr/local/lib64/libstdc++.so.6
lrwxrwxrwx 1 root staff 19 Nov 3 08:58 /usr/local/lib64/libstdc++.so.6 -> libstdc++.so.6.0.25
root@x:~# rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6
rm: remove symbolic link '/usr/lib/x86_64-linux-gnu/libstdc++.so.6'? y
root@x:~# ln -s /usr/local/lib64/libstdc++.so.6.0.25 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
root@x:~# ll /usr/lib/x86_64-linux-gnu/libstdc++.so.6
lrwxrwxrwx 1 root root 36 Nov 14 20:18 /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -> /usr/local/lib64/libstdc++.so.6.0.25

重新打开vim,成功,久违的ycm回来了,香;

最后晒一下我的YCM配置:
1 " ycm配置 共享gopls进程:https://hmgle.github.io/vim/2019/09/08/gopls-trick.html
2 let g:ycm_gopls_binary_path = "gopls"
3 let g:ycm_gopls_args = ['-remote=auto']
4 let g:ycm_confirm_extra_conf = 0
5 " 增加全局的文件配置,会增加一点点内存,大概200M左右,具体看引入的头文件量级
6 let g:ycm_global_ycm_extra_conf = '~/kulvenv/ycm_extra_conf.py'
7 " 下列文件自动触发语义补全,默认要输入.或者指针才行
8 let g:ycm_semantic_triggers = {
9 \ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],
10 \ 'cs,lua,javascript': ['re!\w{2}'],
11 \ }
12 let g:ycm_filetype_whitelist = {"c": 1, "cpp":1, "objc":1, "sh":1, "zsh":1,"go":1, "py":1}
13 let g:ycm_show_diagnostics_ui = 1
14 " 自定义补全弹窗颜色
15 highlight PMenu ctermfg=0 ctermbg=242 guifg=black guibg=darkgrey
16 highlight PMenuSel ctermfg=242 ctermbg=8 guifg=darkgrey guibg=black

Share
分类: VIM 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.

注意: 评论者允许使用'@user空格'的方式将自己的评论通知另外评论者。例如, ABC是本文的评论者之一,则使用'@ABC '(不包括单引号)将会自动将您的评论发送给ABC。使用'@all ',将会将评论发送给之前所有其它评论者。请务必注意user必须和评论者名相匹配(大小写一致)。