python / python/cpython

configure.ac assumes -std=c11 rather than checking it, which causes make failures on old compilers

オープン
#131,093 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

build type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:
Repro

Steps:

  1. Run a container having a gcc that does not support the C11 standard (e.g., gcc 4.4.7)
  2. tar xvJf Python-3.13.2.tar.xz && cd Python-3.13.2
  3. ./configure && make

Expected: configure reports an error like "your compiler doesn't support C11"

Observed: configure succeeds, only for make to fail.

...
configure: creating Makefile
configure:

If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations

configure: Your compiler or platform does have a working C11 stdatomic.h. A future version of Python may require stdatomic.h.
sh-4.1# make
gcc -std=gnu99 -pthread -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
cc1: error: unrecognized command line option "-std=c11"
make: *** [Programs/python.o] Error 1
Suggestion

I think this can be fixed by changing configure.ac here:

-    CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
+    AX_CHECK_COMPILE_FLAG([-std=c11],[
+        CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
+    ], [
+        AC_MSG_ERROR([Python requires -std=c11 on gcc])
+    ], [-Werror])
Related issues

#91731

CPython versions tested on:

3.12.9, 3.13.2

Operating systems tested on:

Linux

Linked PRs
  • gh-133608

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

影響を受けるロジックは、-std=c11 が追加されている、参照された行の近くの configure.ac にあります。GCC 4.4.7 で ./configure && make を使用して再現し、make を失敗させるのではなく、configure がサポートされていない C11 コンパイラーを報告することを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c
領域
build-system
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。