On macOS, Configure script assumes that "gcc" is an alias for "clang", even if it really is GCC
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- shell
- 领域
- build-system
调研方向
从 configure.ac 的 1491–1514 行附近开始,并在 macOS 上使用 CC='/opt/local/bin/gcc-mp-12' pyenv install --verbose 3.10.6 重现问题。将编译器识别结果与那里选择的 Darwin PGO flags 进行比较。完成的标准是实际的 GCC 使用 -fprofile-generate,而 Apple Clang 继续使用现有 flags,且不破坏 configure 路径。
由索引模型根据 Issue 内容生成。
描述
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.6
Outcome:
...
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.
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 558
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/cpython 的其他 Issue
-
docs pending
难度 2/5 1-3 小时 新手友好度 78/100
-
stdlib type-feature
难度 2/5 1-3 小时 新手友好度 78/100
-
stdlib type-feature
难度 2/5 1-3 小时 新手友好度 72/100
-
build type-bug
难度 2/5 1-3 小时 新手友好度 76/100
-
stdlib topic-email type-feature
难度 2/5 1-3 小时 新手友好度 70/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
难度 2/5 1-3 小时 新手友好度 88/100
OpenHands/extensions#626 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
CSCfi/sd-search-api#39 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 68/100
StevenBlack/hosts#3255 ·