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/
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
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
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'
> 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
I solved it -
http://stackoverflow.com/questions/10059539/compiling-vim-with-python-support-on-ubuntu
Thanks,
Senthil