Skip to content

gh-131093: Enforce -std=c11 for gcc at configure time rather than make time #133608

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CS-cwhite
Copy link

@CS-cwhite CS-cwhite commented May 7, 2025

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.

The changes to configure are the result of running Tools/build/regen-configure.sh.

Manual test on gcc 4.4.7:

Before:

$ ./configure
... (after it builds for a while)
gcc -std=gnu99 -pthread -c -fno-strict-overflow -Wsign-compare ...  -DPy_BUILD_CORE -o Parser/lexer/buffer.o Parser/lexer/buffer.c
cc1: error: unrecognized command line option "-std=c11"cc1: error: unrecognized command line option "-std=c11"

After:

$ ./configure
...
checking whether C compiler accepts -std=c11... no
configure: error: Python requires -std=c11 on gcc

Fixes #131093.

@python-cla-bot
Copy link

python-cla-bot bot commented May 7, 2025

The following commit authors need to sign the Contributor License Agreement:

CLA signed

@CS-cwhite
Copy link
Author

CS-cwhite commented May 7, 2025

I previously signed the CLA on behalf of my organization, at the direction of the organization's legal department. Is there a way to tell CLA-bot to recognize that?

@AA-Turner
Copy link
Member

AA-Turner commented May 8, 2025

cc @ambv re CLA

@AA-Turner AA-Turner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 8, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @AA-Turner for commit b4fbd36 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133608%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 8, 2025
@CS-cwhite
Copy link
Author

This is my first cpython PR, so I don't know --- do I have any action items from the build failures? E.g., Check if generated files are up to date appears to be checking C code, and this PR doesn't touch any C code. The failures don't appear to be related to this PR's changes, but I'm happy to work on fixes if they are!

@AA-Turner
Copy link
Member

We had some teething issues with the bump to 3.15, so I've updated the branch to check the failures aren't related. In general, you may find the Python Developer's Guide useful.

A

@ZeroIntensity ZeroIntensity added the build The build process and cross-build label May 11, 2025
@ZeroIntensity
Copy link
Member

I previously signed the CLA on behalf of my organization, at the direction of the organization's legal department.

I think redoing the commits with whatever email you signed with and then force-pushing should work.

…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 CS-cwhite force-pushed the bugfix/SDX-12236-configure-std-c11 branch from f14b4f8 to bc5c9ed Compare May 12, 2025 15:26
@CS-cwhite
Copy link
Author

@ZeroIntensity Thanks! I checked, and the email is the same. However, the author name was different (it was "Chris White" in the commit but "Christopher White" on the CLA). I amended the commit to show the same name as the CLA in case that made a difference.

@AA-Turner
Copy link
Member

I've asked internally for advice.

A

@AA-Turner
Copy link
Member

AA-Turner commented May 12, 2025

@CS-cwhite, the advice I've had is that you should click the button to sign the CLA again. Sorry for the delay and the trouble this has caused. There's some more background/colour in #120171 (comment)

A

@@ -0,0 +1,3 @@
On GCC-compatible compilers, check at configure time that ``-std=c11``
works. This way you don't hit an "invalid option" error at make time on old
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
works. This way you don't hit an "invalid option" error at make time on old
works. This way you don't hit an "invalid option" error at build time on old

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review build The build process and cross-build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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