简体   繁体   中英

compiling vim with python support on Ubuntu

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/

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM