Last Updated: February 25, 2016
· purak

Compile Vim with Python support

If you want to compile vim with python(--enable-pythoninterp) support, but you get error messages like that:

objects/if_python.o: In function `DoPythonCommand.isra.29':
if_python.c:(.text+0x38de): undefined reference to `PyGILState_Ensure'
if_python.c:(.text+0x3942): undefined reference to `PyGILState_Release'
if_python.c:(.text+0x3a0f): undefined reference to `PyEval_InitThreads'
if_python.c:(.text+0x3b93): undefined reference to `PyGILState_Release'
if_python.c:(.text+0x3b98): undefined reference to `PyGILState_Ensure'
if_python.c:(.text+0x3bce): undefined reference to `PyGILState_Release'
objects/if_python.o: In function `python_end':
if_python.c:(.text+0x4939): undefined reference to `PyGILState_Ensure'
collect2: error: ld returned 1 exit status
link.sh: Linking failed
make[1]: *** [vim] Error 1
make[1]: Leaving directory `/var/tmp/lpms/app-editors/vim-7.3.798/source/vim73/src'
make: *** [first] Error 2

You must compile Python-2.x with threads support to fix the issue.

Note: I didn't try to compile vim with python3 support. So that this fix may valid for python2 support.

Happy hacking!

Say Thanks
Filed Under