AllanChain / blog

Blogging in GitHub issues. Building with Astro.
https://allanchain.github.io/blog/
MIT License
13 stars 0 forks source link

How I compile and install Vim with +python3 #151

Open AllanChain opened 3 years ago

AllanChain commented 3 years ago

View Post on Blog

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

Break Down

Clean before try again

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

make clean distclean

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

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
karlosp commented 3 years ago

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.