-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
buildThe build process and cross-buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Your environment
- MacOS 12.4
Bug report
Apologies if this is a known "wontfix" issue, I didn't see it mentioned in a search of past issues.
The configure.ac script assumes that gcc is actually clang on MacOS and uses Clang's -fprofile-instr-generate flag for PGO instead of GCC's -fprofile-generate, leading to build failure when PGO is turned on.
Steps to reproduce on MacOS:
sudo port install gcc
# or `brew install gcc`, same result
CC='/opt/local/bin/gcc-mp-12' pyenv install --verbose 3.10.6Outcome:
...
gcc-mp-12: error: unrecognized command-line option '-fprofile-instr-generate'; did you mean '-fprofile-generate'?
...
The problem is found here: https://github.com/python/cpython/blob/3.10/configure.ac#L1491-L1514
case $CC in
*clang*)
# Any changes made here should be reflected in the GCC+Darwin case below
...
;;
*gcc*)
case $ac_sys_system in
Darwin*)
PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"MacOS (perhaps annoyingly) ships with gcc as an alias for clang, so the configure script sensibly assumes that gcc is actually clang and sets its options accordingly.
However, that isn't always a correct assumption!
Possible solutions:
- Check for the presence of
Apple clangin the$CC --versionoutput. - Check that the absolute path of
$CCis/usr/bin/gcc.
Metadata
Metadata
Assignees
Labels
buildThe build process and cross-buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error