-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
On macOS, Configure script assumes that "gcc" is an alias for "clang", even if it really is GCC #96249
Comments
Here's a rudimentary patch that should hopefully fix this particular issue, although I don't know if there will be other problems downstream of this one: --- configure.ac 2022-08-01 16:25:27.000000000 -0400
+++ configure.ac 2022-08-24 16:44:31.000000000 -0400
@@ -1420,7 +1420,7 @@
;;
esac
;;
- *gcc*)
+ /usr/bin/gcc)
case $ac_sys_system in
Darwin*)
LTOFLAGS="-flto -Wl,-export_dynamic"
@@ -1431,6 +1431,9 @@
;;
esac
;;
+ *gcc*)
+ LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
+ ;;
esac
if test "$ac_cv_prog_cc_g" = "yes"
@@ -1488,7 +1491,7 @@
fi
fi
;;
- *gcc*)
+ /usr/bin/gcc)
case $ac_sys_system in
Darwin*)
PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
@@ -1499,9 +1502,9 @@
then
LLVM_PROF_ERR=yes
if test "${REQUIRE_PGO}" = "yes"
- then
- AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.])
- fi
+ then
+ AC_MSG_ERROR([llvm-profdata is required for a --enable-optimizations build but could not be found.])
+ fi
fi
;;
*)
@@ -1512,6 +1515,12 @@
;;
esac
;;
+ *gcc*)
+ PGO_PROF_GEN_FLAG="-fprofile-generate"
+ PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
+ LLVM_PROF_MERGER="true"
+ LLVM_PROF_FILE=""
+ ;;
*icc*)
PGO_PROF_GEN_FLAG="-prof-gen"
PGO_PROF_USE_FLAG="-prof-use" |
Thanks for the report. There are other places in configure.ac where there are or should be these kinds of tests. I think we should bite the bullet and fix them comprehensively including making |
FWIW 3.11 has a new |
Note to self, should probably update #94760 to use this approach as well. |
Your environment
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 thatgcc
is actuallyclang
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:
Outcome:
The problem is found here: https://github.com/python/cpython/blob/3.10/configure.ac#L1491-L1514
MacOS (perhaps annoyingly) ships with
gcc
as an alias forclang
, so the configure script sensibly assumes thatgcc
is actuallyclang
and sets its options accordingly.However, that isn't always a correct assumption!
Possible solutions:
Apple clang
in the$CC --version
output.$CC
is/usr/bin/gcc
.The text was updated successfully, but these errors were encountered: