# Unversioned COMPILER symbol for getcompiler.c

**URL:** <https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735>\
**Category:** Core Development\
**Tags:** build\
**Created:** [May 12, 2025, 6:20pm UTC](https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735 "2025-05-12T18:20:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcepl](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/mcepl/32/24095_2.png) [@mcepl](https://discuss.python.org/u/mcepl)\
**Post date:** [May 12, 2025, 6:20pm UTC](https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735/1 "2025-05-12T18:20:36Z")

</div>

Hello,

while going through the patches for the openSUSE Python interpreter, I have hit on this gem [python-3.3.0b1-fix\_date\_time\_compiler.patch](https://build.opensuse.org/projects/devel:languages:python:Factory/packages/python314/files/python-3.3.0b1-fix_date_time_compiler.patch?expand=1):

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

Index: Python-3.14.0b1/Makefile.pre.in
===================================================================
--- Python-3.14.0b1.orig/Makefile.pre.in	2025-05-12 10:57:03.566724942 +0000
+++ Python-3.14.0b1/Makefile.pre.in	2025-05-12 10:57:41.504010702 +0000
@@ -1874,6 +1874,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)"' \

```

The point of the patch is to avoid defining `COMPILER` symbol as versioned (what happens with the current `getcompiler.c`), because we want to be able to produce identical binary for various reasons with even slightly different versions of GCC compiler.

Would it be possible to add a capability of having such non-versioned `COMPILER` to the upstream code? Even if it just was a bit environmental variable in the style of `SOURCE_DATE_EPOCH`. For example, `UNVERSIONED_COMPILER` with value for example `GCC`.

What do you think? Should I prepare patch on `getcompiler.c` with such variant?

---

<div class="post-metadata">

**Author:** ![brettcannon](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brettcannon/32/34895_2.png) [@brettcannon](https://discuss.python.org/u/brettcannon)\
**Post date:** [May 12, 2025, 10:33pm UTC](https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735/2 "2025-05-12T22:33:15Z")

</div>

> [@mcepl](#):
>
> The point of the patch is to avoid defining `COMPILER` symbol as versioned (what happens with the current `getcompiler.c`), because we want to be able to produce identical binary for various reasons with even slightly different versions of GCC compiler.

So basically you want reproducible builds, but where the compiler version doesn’t leak into the binary?

---

<div class="post-metadata">

**Author:** ![mcepl](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/mcepl/32/24095_2.png) [@mcepl](https://discuss.python.org/u/mcepl)\
**Post date:** [May 13, 2025, 7:59am UTC](https://discuss.python.org/t/unversioned-compiler-symbol-for-getcompiler-c/91735/3 "2025-05-13T07:59:26Z")

</div>

Yes, that is exactly what I want. (Stupid Discourse, forcing me to write a long sentence, instead of just “Exactly.”)
