首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >YouCompleteMe安装问题

YouCompleteMe安装问题
EN

Stack Overflow用户
提问于 2015-06-16 18:18:48
回答 1查看 4.5K关注 0票数 1

我正试图在我的大学服务器上安装YouCompleteMe,它运行Debian (在我的用户家中)。当我跑步时:

代码语言:javascript
复制
./install.sh

在“构建CXX对象”阶段之后,我得到以下错误。

代码语言:javascript
复制
[ 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”,我必须重新编译什么?谢谢。

EN

回答 1

Stack Overflow用户

发布于 2015-08-29 20:53:18

我刚刚解决了这个问题;和您的一样:我已经安装了自己的Python。我引用了this solution,但是我做的方式有点不同。

  1. 首先检查您自己的lib dir中是否有libpython2.7.so (在您的例子中是~/lib/)。如果只有libpython2.7.a,则可能需要为共享库重新编译python。请参考this。简而言之,您应该转到python源代码,并且: ./配置--启用-共享\-前缀=$HOME\ LDFLAGS="-Wl,-rpath=$HOME/lib make
  2. 如果您的系统本身有Python,您可能会遇到麻烦。这个问题看上去是:

/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。

,否则,,继续吧。

  1. 现在,我假设库中有libpython2.7.so。稍微修改一下~/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py
代码语言:javascript
复制
- Modify the function `CustomPythonCmakeArgs()`, replacing

python_library =‘{0}.a’.格式( lib_python )

使用

python_library =‘{0}..so’.格式( lib_python )

-在附近加一条线

python_executable =‘{0}/bin/python’.格式( python_prefix )

您的python解释器可能位于其他位置,请相应地更改它。

代码语言:javascript
复制
- 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并重新安装

代码语言:javascript
复制
./install.py --clang-completer
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30875211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档