[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

compiling 3.7.0 from source with custom libffi path

On Monday, September 24, 2018 at 11:48:59 AM UTC+3, Fetchinson . wrote:
> I'm trying to compile python 3.7.0 from source with a custom libffi
> path and the compiler/linker doesn't seem to pick up the right
> version. The system libffi doesn't have the development files so I've
> installed the latest libffi (also from source) to /opt/custom but
> still I get
> INFO: Could not locate ffi libs and/or headers
> Failed to build these modules:
> _ctypes
> Although I compile python with --prefix=/opt/custom because that's the
> location I'd like to install it too. So how do I tell the build system
> where to find my custom libffi?
> Cheers,
> Daniel
> -- 
> Psss, psss, put it down! - http://www.cafepress.com/putitdown

After some messing around with the build scripts, I figured it out. This works for me:

0. Choose installation path for FFI -> $LIBFFI_PATH
1. Configure, build, install libffi:
1a. Download libffi from https://sourceware.org/libffi/ and untar it
1b. ./configure --prefix $LIBFFI_PATH
1c. make
1d. make install
2. Configure CPython: (I'm using tcsh syntax, it is slightly different with bash)
2a. setenv PKG_CONFIG_PATH $LIBFFI_PATH/lib/pkgconfig/
2b. setenv LDFLAGS "-L $LIBFFI_PATH/lib64/"
2c. /configure --with-pydebug
3. Build
3a. setenv LD_LIBRARY_PATH "${LIBFFI_PATH}/lib64/"
3b. make -s -j2 

Good luck!