python / python/cpython

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

オープン
#136,267 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

build type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Tools/build/generate-build-details.py から始め、GIL-enabled ビルドと GIL-disabled ビルドを分けて使用し、issue のコマンドを再現します。生成された build-details.json のフィールドをターゲットビルドと比較し、特に abi.flags、libpython.static、suffixes.extensions、プラットフォーム文字列を確認します。メタデータが build-Python と target-Python のデータを混在させず、ターゲットビルドを一貫して記述していれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
build-system
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。