python / python/cpython

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

Đang mở
#136,267 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

build type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với Tools/build/generate-build-details.py và tái hiện lệnh trong issue bằng cách sử dụng các bản build GIL-enabled và GIL-disabled riêng biệt. So sánh các trường được tạo trong build-details.json với bản build đích, đặc biệt là abi.flags, libpython.static, suffixes.extensions và các chuỗi nền tảng; được xem là hoàn tất khi metadata nhất quán mô tả bản build đích thay vì trộn lẫn dữ liệu của build-Python và target-Python.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.