building 3.7.1 from source, _ctypes and libffi troubles

Fetchinson . fetchinson at
Thu Dec 20 16:48:36 EST 2018

Hi all, I'm trying to build 3.7.1 from source and having trouble with
libffi and _ctypes. I'm on linux and have installed libffi also from
source to a custom location:


I have no idea why the installation is somewhat scattered, these are
the default locations that were created by

./configure --prefix=$HOME/opt

of the source libffi.

In any case, just to be sure, I've copied the header files to


Looks like pkg-config works as intended:

[fetch at fetch opt]$ pkg-config --libs libffi
-L/home/fetch/opt/lib/../lib64 -lffi

[fetch at fetch opt]$ pkg-config --cflags libffi

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

And still I get

Failed to build these modules:

from make when I try to build python 3.7.1 Also tried adding
--with-system-ffi to ./configure but that didn't help either.

Does anyone have an idea what's wrong? I've seen some related bug reports, e.g.

but these were typically solved by the OP installing libffi from the
repository of his/her distro. Note that in my case I must compile
libffi from source.

Any ideas?

Thanks a lot,

Psss, psss, put it down! -

More information about the Python-list mailing list