Compiling vim with python support on Ubuntu

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

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

The config directory contains the config.c file. The execution step will fail.

 ... 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 tried stable builds, tuned settings, etc. But did not find a definitive answer. Also vim builds without a python interpreter.

Here is full

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

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

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

+7
source share
3 answers

Answering my question after much research. On some Ubuntu installations, files that vim is looking for may be missing .

Realizing that I went with a custom Python source installation ( ./configure --prefix=/home/senthil/localpython; make; make install ), and then started compiling vim with this.

  • Set your path so that python points to a new local installation.

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

  • Then run 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 using the local python interpreter. As reported by various sources, this increases the vim size, and I also felt that the speed was significantly reduced. Just after completing this exercise (really with patience), I think I would like to use a system compiled by vim itself.

+3
source

get configdir using /usr/bin/python2.7-config --configdir

t

 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
source

Before compiling Vim, install python-dev and python2.7-dev (or any one of them matches your version of python). These two packages may point to the same files, but it worked for me.

+2
source

All Articles