python / python/cpython

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

Aperta
#144,121 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

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

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 Python/getcompiler.c e dalle relative regole di build in Makefile.pre.in, quindi esamina il lavoro collegato in gh-144124. Verifica come viene costruita la definizione di COMPILER e rendi facoltativa la sua forma statica senza introdurre simboli del compilatore generati dinamicamente; verifica che la build rimanga riproducibile.

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

Valutazione

Stack tecnologico
c
Ambito
build-system
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.