8

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/

10
  • Could you please include more lines of error messages? BTW, this is a linking error, which often happens because of incorrect paths to library. Did you check paths to the libraries? Commented Apr 8, 2012 at 0:58
  • 2
    Why do you just not try vim-nox? Commented Apr 8, 2012 at 1:45
  • @eleweek - Included links to output and error. Commented Apr 8, 2012 at 2:18
  • 1
    Did you sudo apt-get build-dep vim-common? Commented Apr 8, 2012 at 5:13
  • Yes @AndreyYazu. I did sudo apt-get build-dep vim ( that's the command). Commented Apr 8, 2012 at 13:34

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

2

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.

3 Comments

I think the OP's answer is more sufficient.
OP's answer is certainly longer, but it didn't work for me. Also, I'd be surprised if it did work. Why does it make sense to give Vim a config file for a Python interp that's not the system Python interp?
@AlexBeal how do I install python-dev? I am trying to install it on debian (and I have no root privileges)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.