Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/

like image 393
Senthil Kumaran Avatar asked Apr 08 '12 00:04

Senthil Kumaran


People also ask

How do I build vim with python support?

You need to compile Vim yourself or get a prebuilt Vim package that was compiled with Python support. If you're on a Debian based system, the easiest way is to download the vim-gnome or vim-gtk package from apt ( apt install vim-gtk for instance). Other distros might have a similar package with python support built in.

Does vim support python?

Using Vim as a Python IDE The python-mode project is a Vim plugin with syntax highlighting, breakpoints, PEP8 linting, code completion and many other features you'd expect from an integrated development environment.

Where is python config dir?

For most users, the configuration directory will be ~/. ipython . Previous versions of IPython on Linux would use the XDG config directory, creating ~/. config/ipython by default.


1 Answers

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.

like image 105
Senthil Kumaran Avatar answered Sep 30 '22 10:09

Senthil Kumaran