Closed
Description
Bug report
Bug description:
When building PyQt6 with the latest 3.12 branch, I get the following error:
g++ -c -pipe -g -O2 -ffile-prefix-map=/pyqt6=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -fno-exceptions -Wall -Wextra -D_REENTRANT -fPIC -DPy_LIMITED_API=0x03090000 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_CORE_LIB -I. -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/python3.12 -I/usr/include/x86_64-linux-gnu/qt6 -I/usr/include/x86_64-linux-gnu/qt6/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt6/mkspecs/linux-g++ -o dbus.o ../../../../dbus/dbus.cpp
In file included from /usr/include/c++/14/utility:68,
from /usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:15,
from /usr/include/x86_64-linux-gnu/qt6/QtCore/qcoreapplication.h:7,
from /usr/include/x86_64-linux-gnu/qt6/QtCore/QCoreApplication:1,
from ../../../../dbus/dbus.cpp:29:
/usr/include/c++/14/bits/stl_relops.h:86:5: error: template with C linkage
86 | template <class _Tp>
| ^~~~~~~~
In file included from /usr/include/python3.12/Python.h:107,
from /usr/include/dbus-1.0/dbus/dbus-python.h:34,
from ../../../../dbus/dbus.cpp:27:
/usr/include/python3.12/tracemalloc.h:4:1: note: ‘extern "C"’ linkage started here
4 | extern "C" {
| ^~~~~~~~~~
This happened because of the commit 65bca19, which changed the structure of tracemalloc.h
to the following:
#ifndef Py_TRACEMALLOC_H
#define Py_TRACEMALLOC_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef Py_LIMITED_API
/* ... */
#ifdef __cplusplus
}
#endif
#endif /* !Py_LIMITED_API */
#endif /* !Py_TRACEMALLOC_H */
Here, if Py_LIMITED_API
is defined, the extern "C"
block is opened but never closed.
This problem does not affect 3.13 and newer versions, because the order is different there. I am going to submit a trivial pull request to fix this.
CPython versions tested on:
3.12
Operating systems tested on:
Linux