2015-11-01 71 views
0

我試圖安裝YouCompleteMe爲Vim 7.4與包括修補程序1-712在Ubuntu 15.10。Vim錯誤`未定義的符號:PyUnicodeUCS2_AsWideChar`安裝後YouCompleteMe

我已經hand編譯YouCompleteMe因爲我遇到了一個錯誤看起來像這樣:

/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC 

正如FAQ Section指出,加入-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so將解決這個問題。因此,與此compliled它來代替:

cmake -G "Unix Makefiles" -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp 

則:

cmake --build . --target ycm_support_libs --config Release 

在編譯時這段時間我沒有遇到任何錯誤,但是當我打開Vim的我,我看這個:

import ycm_client_support 
          ImportError: /home/austin/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so: undefined symbol: PyUnicodeUCS2_AsWideChar 















Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython: 
line 33: 
Traceback (most recent call last): 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython: 
line 33: 
    File "<string>", line 29, in <module> 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython: 
line 33: 
    File "/home/austin/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 32, in <module> 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython: 
line 33: 
    from ycm.omni_completer import OmniCompleter 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython: 
line 33: 
    File "/home/austin/.vim/bundle/YouCompleteMe/autoload/../python/ycm/omni_completer.py", line 22, in <module> 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPython: 
line 33: 
    from ycmd.completers.completer import Completer 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPyth 
on: 
line 33: 
    File "/home/austin/.vim/bundle/YouCompleteMe/autoload/../third_party/ycmd/ycmd 
/completers/completer.py", line 25, in <module> 
Press ENTER or type command to continue 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPyth 
on: 
line 33: 
    from ycm_client_support import FilterAndSortCandidates 
Error detected while processing function youcompleteme#Enable..<SNR>64_SetUpPyth 
on: 
line 33: 
ImportError: /home/austin/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_ 
support.so: undefined symbol: PyUnicodeUCS2_AsWideChar 

有誰知道如何解決這個問題?

回答

0

這看起來像在Python FAQ中描述的問題=>https://docs.python.org/2/faq/extending.html#when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2

「解決這個問題的唯一方法是使用具有使用Unicode字符大小相同建一個Python二進制編譯的擴展模塊。」

它可能爲你測試你的蟒Unicode字符與規模:

import sys 
if sys.maxunicode > 65535: 
    print 'UCS4 build' 
else: 
    print 'UCS2 build' 
+0

很抱歉這麼晚纔回復,因爲我有學校工作。我試過測試我的python的Unicode大小,它是'UCS4 build',它需要是UCS2,對嗎?那麼,你確切知道該怎麼做? –

+1

好吧,從源代碼重新安裝python(使用--prefix =/usr/local不會干擾系統Python),或者從原始Ubuntu軟件包(http://superuser.com/questions/24326/)構建自己的deb文件如何對修改-A-DEB包) 如果重新安裝源的蟒蛇,使用: 」運行./configure --enable-unicode的UCS2' = 配置建立與UCS2支持的來源。 (但ucs2是默認值...因此它沒有必要......)s) – FBruynbroeck

+0

我已經從源代碼重新安裝了我的python,並檢查它是否是UCS2版本,它是。我添加了'-DPYTHON_EXECUTABLE:FILEPATH =/usr/local/bin/python2'到cmake,但仍然得到相同的錯誤。我認爲這個錯誤是vim使用的python解釋器,因爲當我查看vim使用的是UCS4構建(我的默認python)時。 –