Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got an error while building with CMake -Python2.7.a: error adding symbols #1699

Closed
isacikgoz opened this issue Sep 22, 2015 · 2 comments
Closed

Comments

@isacikgoz
Copy link

Hi,

First of all, thank you for developing this kind of application to improve our productivity. I am new to Linux environment and new to vim as well.

I am trying to use YCM but i cannot build it at the moment. I got an error at 90% while building with CMake. The error was:

/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: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[3]: *** [/home/ibrahim/.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 `

Eventually i built YCM, after that i get some error from vim

Error detected while processing function youcompleteme#Enable..<SNR>69_SetUpPython: line 34: Traceback (most recent call last): Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable..<SNR>69_SetUpPython: line 34: File "<string>", line 30, in <module> Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable..<SNR>69_SetUpPython: line 34: File "/home/ibrahim/.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>69_SetUpPython: line 34: from ycm.omni_completer import OmniCompleter Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable..<SNR>69_SetUpPython: line 34: File "/home/ibrahim/.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>69_SetUpPython: line 34: from ycmd.completers.completer import Completer Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable..<SNR>69_SetUpPython: line 34: File "/home/ibrahim/.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>69_SetUpPython: line 34: from ycm_client_support import FilterAndSortCandidates Press ENTER or type command to continue Error detected while processing function youcompleteme#Enable..<SNR>69_SetUpPython: line 34: ImportError: /home/ibrahim/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so: undefined symbol: PyUnicodeUCS2_FromEncoded Object `

@micbou
Copy link
Collaborator

micbou commented Sep 23, 2015

See issue #1639. Your python is certainly not built with the --enable-shared (first error) and --enable-unicode=ucs4 (second error) flags. I am closing this since it is a configuration issue.

@micbou micbou closed this as completed Sep 23, 2015
@isacikgoz
Copy link
Author

Well, finally solved this issue.

I will explain my experience briefly.

I had to reinstall Ubuntu 14.04 because I messed up python libraries. You need to rebuild python. In order to do that I strongly recommend to replace pre-installed python with your new one. I did not want to take any risk so I build python 2.7.6 with --enable-shared and --enable-unicode=ucs4 configurations. Keep in mind that before you configure python you should install some dependencies:

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

source: http://askubuntu.com/questions/101591/how-do-i-install-python-2-7-2-on-ubuntu

You NEED gocode. -in my case I was trying to use YCM for go-lang auto completion and I missed this point form the installation guide- Here you can find installation instruction for gocode:

https://github.com/nsf/gocode

after these you can easily build and use.

For Pathogen users like me

0- make sure your Vim has python support. To see that :echo has('python') if not, pre-built vim has python and you can get it by sudo apt-get install vim
1- git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/
2- cd ~/.vim/bundle/YouCompleteMe/ and then git submodule update --init --recursive
3- make sure you have right built python I explained above.
4- make sure you have cmake if you dont have: sudo apt-get install cmake
5- cd ~/.vim/bundle/YouCompleteMe/ and then ./install.py --gocode-completer
6- use.

Sorry for mess, as I mentioned before I am new to Linux environment. Now YCM works without any issues.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants