compiling vim with python support on Ubuntu

非 Y 不嫁゛ 提交于 2019-12-05 22:14:56

问题


I am trying to compile vim from source with python interpreter on Ubuntu. I have installed the dependencies for vim, installed python2.7-devel and python2.7-dbg packages on Ubuntu and do the configure step like this

./configure --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config

The config directory does contain the config.c file. The make step fails with the following error.

...

objects/py_config.o:(.data+0xcc): undefined reference to `initcStringIO'
objects/py_config.o:(.data+0xd4): undefined reference to `initcPickle'
objects/py_config.o:(.data+0xdc): undefined reference to `initzlib'
collect2: ld returned 1 exit status
make: *** [vim] Error 1

I have tried stable builds, tweaked around configure etc. But do not find a definitive answer. Also vim builds without the python-interpreter.

Here the complete

output - http://paste.pocoo.org/show/577749/

error - http://paste.pocoo.org/show/577752/

Makefile - http://paste.pocoo.org/show/577751/


回答1:


Answering my own question after doing significant research. Looks in certain Ubuntu installs, the files which vim is looking for compilation may be missing.

After realizing that I went ahead with custom install of Python source (./configure --prefix=/home/senthil/localpython; make; make install) and then proceeded with vim compilation aginst this one.

  1. Set your path so that python points to the new local install.

    PATH=/home/senthil/localpython/bin:$PATH

  2. Then start the compilation with the following flags.

    ./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=/home/senthil/localpython/lib/python2.7/config

You should see that vim compiles fine with using the local python interpreter. As has been informed by various sources, this increases the size of vim and I also felt that the speed had significant become slower. Just after finishing this exercise (in a really way with patience), I think, I would like to use the system compiled vim itself.




回答2:


get the configdir with /usr/bin/python2.7-config --configdir

ie:

sudo apt-get build-dep vim 
hg clone https://vim.googlecode.com/hg/ vim
./configure --enable-pythoninterp --with-features=huge --prefix=$HOME/opt/vim --with-python-config-dir=$(/usr/bin/python2.7-config --configdir)
make && make install



回答3:


Before compiling Vim, install python-dev and python2.7-dev (or whichever dev matches your python version). Those two packages might point to the same files, but it worked for me.



来源:https://stackoverflow.com/questions/10059539/compiling-vim-with-python-support-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!