我正试图在我的大学服务器上安装YouCompleteMe,它运行Debian (在我的用户家中)。当我跑步时:
./install.sh在“构建CXX对象”阶段之后,我得到以下错误。
[ 98%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/versioning.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/ycm_client_support.cpp.o
Linking CXX shared library /home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so
/usr/bin/ld: /home/arenduc1/lib/../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
/home/arenduc1/lib/../lib/libpython2.7.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so] Error 1
make[2]: *** [ycm/CMakeFiles/ycm_client_support.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
Linking CXX shared library /home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
/usr/bin/ld: /home/arenduc1/lib/../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
/home/arenduc1/lib/../lib/libpython2.7.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so] Error 1
make[2]: *** [ycm/CMakeFiles/ycm_core.dir/all] Error 2
make[1]: *** [ycm/CMakeFiles/ycm_support_libs.dir/rule] Error 2
make: *** [ycm_support_libs] Error 2
Traceback (most recent call last):
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 196, in <module>
Main()
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 189, in Main
BuildYcmdLibs( GetCmakeArgs( args ) )
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 152, in BuildYcmdLibs
_err = sys.stderr )
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/sh/sh.py", line 1021, in __call__
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/sh/sh.py", line 486, in __init__
self.wait()
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/sh/sh.py", line 500, in wait
self.handle_command_exit_code(exit_code)
File "/home/arenduc1/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/sh/sh.py", line 516, in handle_command_exit_code
raise exc(self.ran, self.process.stdout, self.process.stderr)
sh.ErrorReturnCode_2:
RAN: '/usr/bin/make -j 2 ycm_support_libs'
STDOUT:
STDERR:错误消息说“使用-fPIC的recomile”,我必须重新编译什么?谢谢。
发布于 2015-08-29 20:53:18
我刚刚解决了这个问题;和您的一样:我已经安装了自己的Python。我引用了this solution,但是我做的方式有点不同。
libpython2.7.so (在您的例子中是~/lib/)。如果只有libpython2.7.a,则可能需要为共享库重新编译python。请参考this。简而言之,您应该转到python源代码,并且:
./配置--启用-共享\-前缀=$HOME\ LDFLAGS="-Wl,-rpath=$HOME/lib make/usr/bin/ld: /usr/local/lib/libpython2.7.a(抽象.o):在创建共享对象时不能使用将R_X86_64_32重新定位到`.rodata.str1.8‘;使用-fPIC /usr/local/lib/libpython2.7.a重新编译:无法读取符号:坏值
在这种情况下,请参考this solution并返回到步骤1。
,否则,,继续吧。
libpython2.7.so。稍微修改一下~/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py:- Modify the function `CustomPythonCmakeArgs()`, replacingpython_library =‘{0}.a’.格式( lib_python )
使用
python_library =‘{0}..so’.格式( lib_python )
-在附近加一条线
python_executable =‘{0}/bin/python’.格式( python_prefix )
您的python解释器可能位于其他位置,请相应地更改它。
- Change the return value from 返回'-DPYTHON_LIBRARY={0}'.format( python_library ),‘-DPYTHON_DIR={0}’.format( python_include ),
至
返回'-DPYTHON_LIBRARY={0}'.format( python_library ),‘-DPYTHON_DIR={0}’.format( python_include ),'-DPYTHON_EXECUTABLE={0}'.format( python_executable ),
-还记得评论一下
如果OnMac():full_cmake_args.extend( CustomPythonCmakeArgs() )
类似于thisif OnMac():full_cmake_args.extend( CustomPythonCmakeArgs() )
做完这些之后你应该做得很好。返回到~/.vim/bundle/YouCompleteMe并重新安装
./install.py --clang-completerhttps://stackoverflow.com/questions/30875211
复制相似问题