building 3.7.1 from source, _ctypes and libffi troubles

Fetchinson . fetchinson at
Tue Dec 25 07:53:53 EST 2018

>> 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
> pkg-config.

This didn't actually occur for me, I had C_INCLUDE_PATH set and your
second suggestion (see below) worked.

> 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.

Thanks a lot! This indeed worked, now _ctypes compiles no problemlo!


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

More information about the Python-list mailing list