-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Default CC is "gcc" on Mac, but should be "clang" #110577
Comments
I'm leaving some open questions / notes, anyone feel free to provide input. 1. When should
|
Regarding question 1 (when to prefer gcc) it might be relevant that PEP 11 doesn't list gcc as a supported compiler on Darwin, making a stronger case for never selecting gcc unless it's the only detected compiler (weird setup but ok), or it's explicitly set as CC. |
Bug report
Bug description:
configure.ac
has some special handling for detecting the default compiler on Apple platforms. Currently the script will check for both "gcc" and "clang". If both are defined, it only selects clang in case gcc is actually llvm-gcc.cpython/configure.ac
Lines 819 to 823 in ea7b53f
llvm-gcc and hasn't been distributed by Apple since Xcode 5 (2013), so the test will be false in basically all cases (all supported cases?). After this, the decision to set CC is delegated to AC_PROG_CC, which will use "gcc" by default.
If no gcc installed, "gcc" is just an alias to clang, and since clang is now fully supported, this will usually compile just fine. The issue is that the configure script itself will inspect CC (e.g. to apply some flags). Sometimes these checks have an additional guard like
cc_is_clang
orac_sys_system
= "Darwin" but sometimes they don't. E.g. recently I saw warnings about a redundant-fno-semantic-interposition
being set.My very opinionated opinion is that the default CC should always be clang on Apple platforms, just like in the Mac build script. And that some of these CC checks might need to be reviewed. E.g. use
cc_is_clang
whenever is possible, or abstract the actual compiler in a different variable, or possibly—going forward—forget entirely about the "gcc is actually clang" case.CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
The text was updated successfully, but these errors were encountered: