python / python/cpython

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

Ouverte
#154,643 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

build type-bug
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par Include/pyport.h autour de la ligne 494 et par le commit 2cefa70eb92321c39f7d66bd862b2f66cd06f0fa. Reproduisez la compilation du header de CPython 3.15 avec g++ et -Werror=undef, puis consultez le PR lié gh-154650 pour connaître l’orientation actuelle. Le travail est considéré comme terminé lorsque l’inclusion de Python.h signalée n’échoue plus avec la configuration d’avertissements indiquée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp, python
Domaine
build-system
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.