python / python/cpython

macOS: configure does not support linking against a non-system libffi

Abierto
#155,813 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

build OS-mac type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Linked PRs
  • gh-156486

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con las comprobaciones enlazadas de configure.ac alrededor de las líneas 4363–4392 y compáralas con el script configure generado. Sigue cómo interactúan LIBFFI_CFLAGS, LIBFFI_LIBS, la comprobación de libffi del SDK de macOS y la comprobación de pkg-config. El trabajo estará terminado cuando una compilación de macOS pueda conservar la configuración proporcionada por el usuario y enlazar _ctypes contra una libffi que no sea la del sistema.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
build-system
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.