building 3.7.1 from source, _ctypes and libffi troubles

Anssi Saari as at
Fri Dec 21 16:54:53 EST 2018

"Fetchinson . via Python-list" <python-list at> writes:

> And as far as I know pkg-config is used by python's configure script
> so everything should be fine. I also set
> LD_LIBRARY_PATH=/home/fetch/opt/lib:/home/fetch/opt/lib64 and also
> C_INCLUDE_PATH=/home/fetch/opt/include

I looked into this a little. I found that setting C_INCLUDE_PATH as you
did disables finding libffi headers since pkg-config prints nothing with
pkg-config --cflags libffi then and it seems the headers are found with

As for the libraries, detect_modules() in wants to find extra
library directories from the generated makefile so you need to make sure
they actually go in there, like this for example:

LDFLAGS=`pkg-config --libs-only-L libffi` ./configure

Then you'll have CONFIGURE_LDFLAGS and PY_LDFLAGS set in the generated
makefile and will pick up the directory from there.

Anyways, hope it helps. This worked for me on Ubuntu 16.04.5 LTS.

More information about the Python-list mailing list