python / python/cpython

Make COMPILER definition in getcompiler.c optionally static for reproducible builds

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

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

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

説明

Feature or enhancement

Proposal:

SUSE (both for SLE and openSUSE) have been using for a long time (the name of the patchfile starts with python-3.3.0b1 ;)) similar patch to avoid having dynamically generated symbols in the build binaries (version of compilers in this case).

---
 Makefile.pre.in |    5 +++++
 1 file changed, 5 insertions(+)

Index: Python-3.15.0a3/Makefile.pre.in
===================================================================
--- Python-3.15.0a3.orig/Makefile.pre.in	2025-12-19 02:26:23.594002103 +0100
+++ Python-3.15.0a3/Makefile.pre.in	2025-12-19 02:26:28.185444105 +0100
@@ -1926,6 +1926,11 @@
 	      -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \
 	      -o $@ $(srcdir)/Modules/getbuildinfo.c
 
+Python/getcompiler.o: $(srcdir)/Python/getcompiler.c Makefile
+	$(CC) -c $(PY_CORE_CFLAGS) \
+		-DCOMPILER='"[GCC]"' \
+		-o $@ $(srcdir)/Python/getcompiler.c
+
 Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)
 	$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
 		-DPREFIX='"$(host_prefix)"' \

I have discussed upstreaming of this patch on
https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735 and it seems to me that in order to give this issue some momentum, I have to just file PR here.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-144124

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

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

はじめの一歩

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

調査の方向性

Python/getcompiler.c と Makefile.pre.in のビルドルールから始め、次に gh-144124 の関連する作業を確認します。COMPILER 定義がどのように構築されるかを確認し、動的に生成されるコンパイラーシンボルを導入せずに、その静的形式をオプションにします。ビルドが再現可能なままであることを検証します。

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

評価

技術スタック
c
領域
build-system
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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