python / python/cpython

PEP-739 build-details generation is incorrect when cross-building

Aperta
#136,267 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

build type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug report

Bug description:

When doing cross-builds, the PEP-739 build-details.json gets generated using inconsistent data, some of which based on the build python, and some from the target platform python.

See for example the following gist:
https://gist.github.com/itamaro/8f23ebec2e142fd7480241b76c16c4e0

The gist contains the build-details.json generated for a 3.15 GIL-disabled build, using a 3.15 GIL-enabled build as the build-python.

Concretely:

cd ~/pybuild/python/main-default
./configure --with-pydebug
make -j

cd ~/pybuild/python/main-nogil
./configure --with-pydebug --disable-gil
make -j

# now use the GIL-enabled python to regenerate build-details.json for the nogil build
_PYTHON_PROJECT_BASE=. _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_td_darwin_darwin _PYTHON_SYSCONFIGDATA_PATH=build/lib.macosx-14.5-arm64-3.15 ~/pybuild/python/main-default/python.exe -E Tools/build/generate-build-details.py /tmp/build-details.json

Some examples from the gist:

Incorrect - abi.flags is ["d"] instead of ["t", "d"]:

  "abi": {
    "flags": [
      "d"
    ]
  },

Correct - libpython.static has the correct SOABI, including t:

  "libpython": {
    "static": "/usr/local/lib/libpython3.15td.a"
  },

Incorrect - suffixes.extensions includes extensions for the GIL-enabled ABI:

    "extensions": [
      ".cpython-315d-darwin.so",
      ".cpython-315-darwin.so",
      ".abi3.so",
      ".so"
    ]

Notes

I used a "cross-build" on the same MacOS host here, with GIL enabled vs GIL disabled, because it was the easiest for a full end-to-end repro on a single machine.
The issue is more general though, as I originally observed it when generating build-info.json files for a MacOS-target runtime (both GIL enabled and disabled) using a Linux-GIL-enabled build-python. That setup is more involved, but the mixing is also more apparent, with some fields using "darwin" and other fields using "linux-gnu-x86_64" as the multiarch string.

CPython versions tested on:

CPython main branch, 3.15, 3.14

Operating systems tested on:

macOS, Linux

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da Tools/build/generate-build-details.py e riproduci il comando dell’issue usando build separati GIL-enabled e GIL-disabled. Confronta i campi generati di build-details.json con il build di destinazione, in particolare abi.flags, libpython.static, suffixes.extensions e le stringhe della piattaforma; il lavoro è completato quando i metadati descrivono coerentemente il build di destinazione invece di mescolare dati di build-Python e target-Python.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
build-system
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.