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 -

error -

Makefile -

4/8/2012 2:48:18 AM

Accepted Answer

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.


  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.

4/15/2012 4:28:56 AM

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


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

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow