python / python/cpython

configure.ac assumes -std=c11 rather than checking it, which causes make failures on old compilers

Abierto
#131,093 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

build type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Bug report

Bug description:
Repro

Steps:

  1. Run a container having a gcc that does not support the C11 standard (e.g., gcc 4.4.7)
  2. tar xvJf Python-3.13.2.tar.xz && cd Python-3.13.2
  3. ./configure && make

Expected: configure reports an error like "your compiler doesn't support C11"

Observed: configure succeeds, only for make to fail.

...
configure: creating Makefile
configure:

If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations

configure: Your compiler or platform does have a working C11 stdatomic.h. A future version of Python may require stdatomic.h.
sh-4.1# make
gcc -std=gnu99 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
cc1: error: unrecognized command line option "-std=c11"
make: *** [Programs/python.o] Error 1
Suggestion

I think this can be fixed by changing configure.ac here:

-    CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
+    AX_CHECK_COMPILE_FLAG([-std=c11],[
+        CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
+    ], [
+        AC_MSG_ERROR([Python requires -std=c11 on gcc])
+    ], [-Werror])
Related issues

#91731

CPython versions tested on:

3.12.9, 3.13.2

Operating systems tested on:

Linux

Linked PRs
  • gh-133608

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

La lógica afectada se encuentra en configure.ac cerca de la línea referenciada, donde se añade -std=c11. Reprodúcelo con GCC 4.4.7 usando ./configure && make y, a continuación, verifica que configure informe de que el compilador C11 no es compatible, en lugar de permitir que make falle.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
c
Área
build-system
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.