Bug report
Bug description:
On macOS, the configure script does not provide a way to link _ctypes against a non-system libffi.
Although LIBFFI_CFLAGS and LIBFFI_LIBS are documented as configuration variables for libffi, configure first checks for the system libffi from Apple's SDK and if found overwrites these variables.
The pkg-config based check, which does preserve these variables, is never run when the system libffi is detected.
The confusing --with-system-ffi option, removed in Python 3.12 (#100544), provided a way to invoke the pkg-config based configuration on macOS, bypassing the detection of the SDK libffi.
I ran into this while updating python-build-standalone to use the standard extension configuration in 3.12+ (astral-sh/python-build-standalone#1180). Other than patching configure the best option seemed to be to use ac_cv_lib_ffi_ffi_call=no to force the check to fail.
I also found that conda-forge patches configure to get around this issue when building CPython.
Related issues
CPython versions tested on:
3.12, 3.13, 3.14, 3.15, CPython main branch
Operating systems tested on:
macOS
Bug report
Bug description:
On macOS, the
configurescript does not provide a way to link_ctypesagainst a non-systemlibffi.Although
LIBFFI_CFLAGSandLIBFFI_LIBSare documented as configuration variables forlibffi,configurefirst checks for the systemlibffifrom Apple's SDK and if found overwrites these variables.The pkg-config based check, which does preserve these variables, is never run when the system
libffiis detected.The confusing
--with-system-ffioption, removed in Python 3.12 (#100544), provided a way to invoke thepkg-configbased configuration on macOS, bypassing the detection of the SDKlibffi.I ran into this while updating python-build-standalone to use the standard extension configuration in 3.12+ (astral-sh/python-build-standalone#1180). Other than patching
configurethe best option seemed to be to useac_cv_lib_ffi_ffi_call=noto force the check to fail.I also found that conda-forge patches
configureto get around this issue when building CPython.Related issues
CPython versions tested on:
3.12, 3.13, 3.14, 3.15, CPython main branch
Operating systems tested on:
macOS