python / python/cpython

/usr/include/python3.15/pyport.h:494:9: error: ‘__STDC_VERSION__’ is not defined, evaluates to ‘0’ [-Werror=undef]

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

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

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

説明

Bug report

Bug description:

Hello. When building the kmymoney Fedora package, we got:

In file included from /usr/include/python3.15/Python.h:68,
                 from /builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/plugins/woob/interface/woobinterface.cpp:16:
/usr/include/python3.15/pyport.h:494:9: error: ‘__STDC_VERSION__’ is not defined, evaluates to ‘0’ [-Werror=undef]
  494 | #  elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__)
      |         ^~~~~~~~~~~~~~~~

The package uses g++, not gcc.

It has:

#include <Python.h>

The compiler invocation is:

cd /builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/misc && /usr/bin/g++ -DKF_DEPRECATED_WARNINGS_SINCE=0x60000 -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x56200C -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x60000 -DQT_DISABLE_DEPRECATED_BEFORE=0x50f02 -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_FOREACH -DQT_NO_KEYWORDS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_QSTRINGBUILDER -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -Dkmm_gpgfile_EXPORTS -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/misc -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/misc -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/misc/kmm_gpgfile_autogen/include -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2 -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/settings -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/settings -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/dialogs -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/widgets -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/widgets -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/mymoney -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/mymoney/storage -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/interfaces -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/interfaces -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/plugins -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/plugins -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/views -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/dialogs -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/converter -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/dialogs/settings -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/mymoney/storage -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/mymoney -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/wizards/endingbalancedlg -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/wizards/endingbalancedlg -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/wizards/newinvestmentwizard -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/wizards/newinvestmentwizard -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/wizards/newloanwizard -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/wizards/newloanwizard -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/wizards/wizardpages -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/models -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/models -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/icons -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/icons -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/kmymoney/menus -I/builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/menus -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib64/qt6/mkspecs/linux-g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Werror=undef -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -pedantic -Wzero-as-null-pointer-constant -Wmissing-include-dirs -fexceptions -DNDEBUG -std=c++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -UQT_NO_CAST_FROM_ASCII -UQT_NO_CAST_FROM_BYTEARRAY -UQT_NO_CAST_TO_ASCII -UQT_NO_CAST_TO_BYTEARRAY -Wall -Wextra -Wlogical-op -Wno-null-dereference -Wshadow -Wunused -Wno-misleading-indentation -Wsuggest-override -Wcast-qual -Wformat=2 -fno-common -Werror=return-type -Wzero-as-null-pointer-constant -MD -MT kmymoney/misc/CMakeFiles/kmm_gpgfile.dir/kmm_gpgfile_autogen/mocs_compilation.cpp.o -MF CMakeFiles/kmm_gpgfile.dir/kmm_gpgfile_autogen/mocs_compilation.cpp.o.d -o CMakeFiles/kmm_gpgfile.dir/kmm_gpgfile_autogen/mocs_compilation.cpp.o -c /builddir/build/BUILD/kmymoney-5.2.2-build/kmymoney-5.2.2/redhat-linux-build/kmymoney/misc/kmm_gpgfile_autogen/mocs_compilation.cpp

I think that 2cefa70eb92321c39f7d66bd862b2f66cd06f0fa might have exposed the # elif __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__) line outside of # ifdef Py_BUILD_CORE causign this issue.

I don't know yet if there is some other thing that makes other g++ code work and not this one, perhaps it's just the -Werror=undef part. Other code in CPython uses defined(__STDC_VERSION__) && __STDC_VERSION__ .... Perhaps this needs the same treatment?

Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2440571 (fixed by disabling the woob plugin).

CPython versions tested on:

3.15

Operating systems tested on:

Linux

Linked PRs
  • gh-154650

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

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

はじめの一歩

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

調査の方向性

Include/pyport.h の494行付近とコミット 2cefa70eb92321c39f7d66bd862b2f66cd06f0fa から始めてください。-Werror=undef を指定した g++ を使って CPython 3.15 のヘッダービルドを再現し、現在の方針についてリンクされている PR gh-154650 を確認してください。指定された警告設定で、報告されている Python.h のインクルードが失敗しなくなれば完了です。

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

評価

技術スタック
cpp, python
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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