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
-
bug
難度 2/5 1-3 小時 新手友好度 86/100
zostera/django-bootstrap4#894 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
use-agent-os/agent-os#3276 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
難度 2/5 1-3 小時 新手友好度 88/100
NousResearch/hermes-agent#117848 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
zilliztech/memsearch#759 ·