My operating system environment centos 6.6 has an error when installing vim's YCM plug-in.
vim compiles itself, and corresponding interpreted language support has been added.
The python version that comes with the system is 2.6. I compiled and added versions 2.7 and 3.4, so I have these three versions in my environment.
Enter the YCM directory and execute the installation command, the following error occurs:
[90%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/Result.cpp.o
Linking CXX shared library /home/xuanyuan/k-vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: Error: ld returned 1
gmake[3]: * [/home/ xuanyuan/k-vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so] Error 1
gmake[2]: * [ycm/CMakeFiles/ycm_client_support.dir/all] Error 2
gmake[1]: * [ycm/CMakeFiles/ycm_support_libs.dir/rule] Error 2
gmake: * [ycm_support_libs] Error 2
Traceback (most recent call last):
File "/home/xuanyuan/k-vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 327, in <module>
Main()
File "/home/xuanyuan/k-vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 316, in Main
BuildYcmdLibs( args )
File "/home/xuanyuan/k-vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 261, in BuildYcmdLibs
subprocess.check_call( build_command )
File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'ycm_support_libs', '--', '-j', '1']' returned non-zero exit status 2
Traceback (most recent call last):
File "./install.py", line 32, in <module>
Main()
File "./install.py", line 21, in Main
subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '/home/xuanyuan/k-vim/bundle/YouCompleteMe/third_party/ycmd/build.py']' returned non-zero exit status 1
Looking for a solution?
Solved:
Step 1: The shared library of python2.7 is missing, recompile and install python2.7 and add the compilation option --enable-shared.
If the problem is solved, there is no need to perform the following steps, if the following error occurs:
It may be caused by multiple versions of python, the following error:
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
Solution to this error:
Step 2:
Edit the /etc/ld.so.conf file and add the following content /usr/local/lib, directly add a new line that is Can.
After saving, execute the following command (---> is the command prompt, everyone can set it up according to their own needs):
---> /sbin/ldconfig
---> /sbin/ldconfig –v