How I compile and install Vim with +python3

2020-11-15

It's known to all that compiling is hard. Just record it.

 

Disclaimer: There may be many errors and unneccesary parts in this post. But the command works, at least on my machine.

Background #

Somewhat old system. No sudo. Want awesome Vim8 +Python3.8

Quick Answer #

LDFLAGS=-rdynamic ./configure \
    --with-features=huge \
    --enable-fail-if-missing \
    --enable-largefile \
    --enable-multibyte \
    --enable-python3interp \
    --with-python3-command=python3.8 \
    --with-python3-config-dir=$HOME/.pyenv/versions/3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu \
    --prefix=$HOME

make
make install
bash

Break Down #

Clean before try again #

It is not a good news that the second run is very fast.

make clean distclean
bash

Options v.s. Env vars #

Both are important. For example, do not pass vi_cv_path_python as an option, although it's in lower case 😄

User install #

--prefix=$HOME
bash

What is python3-config-dir #

https://vi.stackexchange.com/a/18509

A directory containing config.c

-rdynamic?

It just solves undefined symbol: PyTuple_Type: https://github.com/vim/vim/issues/5509#issuecomment-650468467

Also, just go dynamic (with +python3/dyn) is fine:

./configure \
    --enable-python3interp=dynamic \
    --with-python3-command=python3.8 \
    --with-python3-config-dir=$HOME/.pyenv/versions/3.8.5/lib/python3.8/config-3.8-x86_64-linux-gnu \
    --prefix=$HOME
bash
karlosp
karlosp
2020-11-30

Thank YOU!

You save me. Compiling Vim on RHEL 7 with python support has been killing me for weeks. LDFLAGS=-rdynamic is my saver!

If someone else will be searching for this: --enable-python3interp=dynamic did not work for me but --enable-python3interp works.

2
Leave your comments and reactions on GitHub