Vim compilation with --enable-pythoninterp on Ubuntu

1,215 views
Skip to first unread message

Senthil Kumaran

unread,
Apr 8, 2012, 10:18:47 AM4/8/12
to vim...@googlegroups.com
This one seems tricky, because I tried every suggestion on www. I could do any experiment which could be helpful to compile vim with python interpreter support.


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/

John Beckett

unread,
Apr 9, 2012, 1:10:45 AM4/9/12
to vim...@googlegroups.com
Senthil Kumaran wrote:
> 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'

I am experimenting with this at the moment so the following is
based on floundering around, not actual knowledge, however I
have recently built Vim 7.3.494 on Fedora 16 with Python 2.7.

I used following, then make:

./configure --with-features=huge --prefix=$HOME/opt \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config

src/Makefile includes:
objects/py_config.o: $(PYTHON_CONFDIR)/config.c

The file /usr/lib/python2.7/config/config.c does not contain any
of the identifiers that give the errors above, so my guess is
that you have a mixture of files from Python 2.7 and some
earlier version.

John

Senthil Kumaran

unread,
Apr 9, 2012, 7:17:17 AM4/9/12
to vim...@googlegroups.com
On Monday, 9 April 2012 13:10:45 UTC+8, JohnBeckett wrote:
> src/Makefile includes:
> objects/py_config.o: $(PYTHON_CONFDIR)/config.c
>
> The file /usr/lib/python2.7/config/config.c does not contain any
> of the identifiers that give the errors above, so my guess is
> that you have a mixture of files from Python 2.7 and some
> earlier version.

That's a useful clue. I have the source of Python and I see that those modules defined Module/config.c in the Python source. Instead of pointing to source, I pointed to default install of Python from Ubuntu. Perhaps some problem lies there, let me try in to source or a local prefixed install of Python from source and then try to compile vim against it.

Thanks,
Senthil

Senthil Kumaran

unread,
Apr 10, 2012, 10:04:14 AM4/10/12
to vim...@googlegroups.com
On Monday, 9 April 2012 19:17:17 UTC+8, Senthil Kumaran wrote:
> That's a useful clue. I have the source of Python and I see that those modules defined Module/config.c in the Python source. Instead of pointing to source, I pointed to default install of Python from Ubuntu. Perhaps some problem lies there, let me try in to source or a local prefixed install of Python from source and then try to compile vim against it.

That was it. I compiled Python from Source location and did an alternate installl and then pointed to it. The vim compile was successful. The problem then seems to be python installed via Ubuntu.

However, I am facing another problem, the compilation seems to make the path my system python instead of local installed python. I get this error when I try to start vim

File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 544, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python2.7/site.py", line 236, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib/python2.7/sysconfig.py", line 543, in get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.7/sysconfig.py", line 442, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib/python2.7/sysconfig.py", line 303, in _init_posix
makefile = _get_makefile_filename()
File "/usr/lib/python2.7/sysconfig.py", line 297, in _get_makefile_filename
return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
AttributeError: 'module' object has no attribute 'pydebug'

Senthil Kumaran

unread,
Apr 12, 2012, 12:57:34 PM4/12/12
to vim...@googlegroups.com
On Tuesday, 10 April 2012 22:04:14 UTC+8, Senthil Kumaran wrote:

> File "/usr/lib/python2.7/sysconfig.py", line 303, in _init_posix
> makefile = _get_makefile_filename()
> File "/usr/lib/python2.7/sysconfig.py", line 297, in _get_makefile_filename
> return os.path.join(get_path('platstdlib').replace("/usr/local","/usr",1), "config" + (sys.pydebug and "_d" or ""), "Makefile")
> AttributeError: 'module' object has no attribute 'pydebug'

Hello,

How can I make vim compilation to take a custom PYTHON_CFLAGS value.
I tried,

PYTHON_CLAGS=-I/home/senthil/localpython/include/python2.7

in the shell before compilation and then tried to change that value in Makefile. but it python linker still points to system python ( Ubuntu one does not seem to help vim python configure).

After setting the PYTHON_CFLAGS, I would like to run:

./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=/home/senthil/localpython/lib/python2.7/config


Thanks,
Senthil

Senthil Kumaran

unread,
Apr 16, 2012, 8:56:51 AM4/16/12
to vim...@googlegroups.com
On Friday, 13 April 2012 00:57:34 UTC+8, Senthil Kumaran wrote:
> ./configure --enable-pythoninterp --with-features=huge --with-python-config-dir=/home/senthil/localpython/lib/python2.7/config


I solved it -

http://stackoverflow.com/questions/10059539/compiling-vim-with-python-support-on-ubuntu

Thanks,
Senthil

Reply all
Reply to author
Forward
0 new messages