I've been trying to build Audacity 4 against KDE's Qt 6.11 and had to include a series of patches to make it work. What follows is an AI-generated report of one of such issues. I see no contributing or AI guidelines so I hope this is acceptable.
Multiple source files in the muse framework use Qt types by value, in std::unique_ptr destructors, or in MOC-generated QMetaType registrations while only having a forward declaration of those types. These are latent C++ bugs that compile by accident when the full type definition happens to be transitively included through other headers, but fail when those transitive includes are not present.
Environment
- muse framework commit:
3c5512eb8ee1a863a6123e62bd75a6ab55045752
- Consumer: Audacity 4.0.0 (which uses muse as a git submodule)
- Qt: Built from the KDE Qt fork (the source of the
kde-qt6-core24-sdk snap), version 6.11.1
- Compiler: GCC 13.2.0 (Ubuntu 24.04)
Root cause
Many files forward-declare a Qt class (e.g. class QFile;) and then use it in a context that requires the complete type definition:
std::map<K, std::unique_ptr<QFile>> — the map's destructor instantiates ~unique_ptr<QFile>, which requires QFile to be complete.
Q_PROPERTY(QVariant ...) — MOC generates QMetaType registration code that requires QVariant to be complete.
- Stack-allocated variables (e.g.
QTimer timer;) — require the complete type.
Q_INVOKABLE QWindow* foo() — MOC registers a pointer metatype requiring the pointee to be complete.
With upstream Qt (from the Qt Online Installer, used by MuseScore), these compile because the full definitions are transitively included via other headers. The KDE Qt fork (invent.kde.org/qt/qt/) has progressively cleaned up transitive includes (part of Qt's ongoing "include hygiene" effort), which exposes these latent bugs. As upstream Qt also cleans up transitive includes, these will break for everyone.
Affected files and required fixes
| File |
Missing include |
Type / context |
framework/global/io/internal/filesystem.h |
<QFile> |
std::map<..., std::unique_ptr<QFile>> (also remove the class QFile; forward declaration) |
framework/global/api/apiutils.h |
<QMetaEnum> |
const QMetaEnum& parameter |
framework/ui/api/themeapi.cpp |
<QFontMetrics> |
QFontMetricsF (needs QFontMetrics base) |
framework/ui/view/qmldataformatter.cpp |
<QLocale> |
QLocale locale; |
framework/ui/view/widgetstyle.cpp |
<QPainter> |
QPainter* dereferenced |
framework/cloud/internal/abstractcloudservice.cpp |
<QTimer> |
QTimer timer; |
framework/multiwindows/internal/singleprocess/singleprocessprovider.cpp |
<QCoreApplication> |
QCoreApplication::... |
framework/extensions/internal/extensionsession.h |
"../extensionstypes.h" |
const Manifest& parameter |
framework/interactive/api/interactiveapi.cpp |
<QMetaEnum> |
QMetaEnum used by value |
framework/ui/qml/Muse/Ui/initialletternavigation.h |
<QTimer> |
QTimer m_inputBufferTimer; member field |
framework/ui/qml/Muse/Ui/initialletternavigation.cpp |
<QRegularExpression> |
const QRegularExpression |
framework/interactive/internal/interactive.cpp |
<QQmlEngine> |
QQmlEngine::... |
framework/uicomponents/qml/Muse/UiComponents/abstracttableviewmodel.cpp |
<QTimer> |
QTimer::singleShot(...) |
framework/uicomponents/qml/Muse/UiComponents/filteredflyoutmodel.h |
<QVariant> |
Q_PROPERTY(QVariant ...) |
framework/multiwindows/qml/Muse/MultiWindows/multiinstancesdevmodel.h |
<QVariant> |
Q_PROPERTY(QList<QVariant> ...) |
framework/uicomponents/qml/Muse/UiComponents/polylineplot.cpp |
<QCursor> |
setCursor(Qt::CrossCursor) |
framework/interactive/qml/Muse/Interactive/interactiveprovidermodel.h |
<QWindow> |
Q_INVOKABLE QWindow* (MOC pointer metatype) |
Suggested fix
For each file, add the missing #include directive. In filesystem.h, also remove the class QFile; forward declaration since the full #include <QFile> makes it unnecessary.
I've been trying to build Audacity 4 against KDE's Qt 6.11 and had to include a series of patches to make it work. What follows is an AI-generated report of one of such issues. I see no contributing or AI guidelines so I hope this is acceptable.
Multiple source files in the muse framework use Qt types by value, in
std::unique_ptrdestructors, or in MOC-generatedQMetaTyperegistrations while only having a forward declaration of those types. These are latent C++ bugs that compile by accident when the full type definition happens to be transitively included through other headers, but fail when those transitive includes are not present.Environment
3c5512eb8ee1a863a6123e62bd75a6ab55045752kde-qt6-core24-sdksnap), version 6.11.1Root cause
Many files forward-declare a Qt class (e.g.
class QFile;) and then use it in a context that requires the complete type definition:std::map<K, std::unique_ptr<QFile>>— the map's destructor instantiates~unique_ptr<QFile>, which requiresQFileto be complete.Q_PROPERTY(QVariant ...)— MOC generatesQMetaTyperegistration code that requiresQVariantto be complete.QTimer timer;) — require the complete type.Q_INVOKABLE QWindow* foo()— MOC registers a pointer metatype requiring the pointee to be complete.With upstream Qt (from the Qt Online Installer, used by MuseScore), these compile because the full definitions are transitively included via other headers. The KDE Qt fork (
invent.kde.org/qt/qt/) has progressively cleaned up transitive includes (part of Qt's ongoing "include hygiene" effort), which exposes these latent bugs. As upstream Qt also cleans up transitive includes, these will break for everyone.Affected files and required fixes
framework/global/io/internal/filesystem.h<QFile>std::map<..., std::unique_ptr<QFile>>(also remove theclass QFile;forward declaration)framework/global/api/apiutils.h<QMetaEnum>const QMetaEnum¶meterframework/ui/api/themeapi.cpp<QFontMetrics>QFontMetricsF(needsQFontMetricsbase)framework/ui/view/qmldataformatter.cpp<QLocale>QLocale locale;framework/ui/view/widgetstyle.cpp<QPainter>QPainter*dereferencedframework/cloud/internal/abstractcloudservice.cpp<QTimer>QTimer timer;framework/multiwindows/internal/singleprocess/singleprocessprovider.cpp<QCoreApplication>QCoreApplication::...framework/extensions/internal/extensionsession.h"../extensionstypes.h"const Manifest¶meterframework/interactive/api/interactiveapi.cpp<QMetaEnum>QMetaEnumused by valueframework/ui/qml/Muse/Ui/initialletternavigation.h<QTimer>QTimer m_inputBufferTimer;member fieldframework/ui/qml/Muse/Ui/initialletternavigation.cpp<QRegularExpression>const QRegularExpressionframework/interactive/internal/interactive.cpp<QQmlEngine>QQmlEngine::...framework/uicomponents/qml/Muse/UiComponents/abstracttableviewmodel.cpp<QTimer>QTimer::singleShot(...)framework/uicomponents/qml/Muse/UiComponents/filteredflyoutmodel.h<QVariant>Q_PROPERTY(QVariant ...)framework/multiwindows/qml/Muse/MultiWindows/multiinstancesdevmodel.h<QVariant>Q_PROPERTY(QList<QVariant> ...)framework/uicomponents/qml/Muse/UiComponents/polylineplot.cpp<QCursor>setCursor(Qt::CrossCursor)framework/interactive/qml/Muse/Interactive/interactiveprovidermodel.h<QWindow>Q_INVOKABLE QWindow*(MOC pointer metatype)Suggested fix
For each file, add the missing
#includedirective. Infilesystem.h, also remove theclass QFile;forward declaration since the full#include <QFile>makes it unnecessary.