python / python/cpython

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

Aberta
#155,813 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

build OS-mac type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pelas verificações vinculadas de configure.ac em torno das linhas 4363–4392 e compare-as com o script configure gerado. Rastreie como LIBFFI_CFLAGS, LIBFFI_LIBS, a verificação de libffi do SDK do macOS e a verificação de pkg-config interagem. A tarefa estará concluída quando um build do macOS puder preservar as configurações fornecidas pelo usuário e vincular _ctypes a uma libffi que não seja a do sistema.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
build-system
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
25/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.