Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CS-cwhite opened this issue Mar 11, 2025 · 2 comments
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@CS-cwhite
Copy link

CS-cwhite commented Mar 11, 2025

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

@CS-cwhite CS-cwhite added the type-bug An unexpected behavior, bug, or error label Mar 11, 2025
@picnixz picnixz added the build The build process and cross-build label Mar 12, 2025
@picnixz
Copy link
Member

picnixz commented Mar 12, 2025

PR is welcome!

@vstinner
Copy link
Member

cc @encukou

CS-cwhite added a commit to CS-cwhite/cpython that referenced this issue Mar 13, 2025
…an make time

When compiling under gcc, configure.ac currently assumes -std=c11 rather
than checking it.  This causes configure to succeed but make to fail on
old compilers.  Fix this by adding a check for -std=c11 in configure.ac.
CS-cwhite added a commit to CS-cwhite/cpython that referenced this issue Mar 28, 2025
…an make time

When compiling under gcc, configure.ac currently assumes -std=c11 rather
than checking it.  This causes configure to succeed but make to fail on
old compilers.  Fix this by adding a check for -std=c11 in configure.ac.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants