是否有可能修复从Q_GADGET与Clang和Qt 6多重继承的失败构建?



在我的一个项目中,在GitHub操作下在MacOS上构建:

macos:
name: macos
runs-on: macos-11

子项目JKQtPlotter失败:

[ 64%] Building CXX object 3rdparty/JKQtPlotter/lib/jkqtplotter/CMakeFiles/JKQTPlotterSharedLib.dir/JKQTPlotterSharedLib_autogen/mocs_compilation.cpp.o
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/mocs_compilation.cpp:2:
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/moc_jkqtpbarchart.cpp:10:
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/../../graphs/jkqtpbarchart.h:25:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtGui.framework/Headers/QPainter:1:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtGui.framework/Headers/qpainter.h:48:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtGui.framework/Headers/qpixmap.h:48:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qsharedpointer.h:48:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qsharedpointer_impl.h:65:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qobject.h:54:
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:872:49: error: member 'qt_check_for_QGADGET_macro' found in multiple base classes of different types
IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *),
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:1189:25: note: in instantiation of template class 'QtPrivate::IsGadgetHelper<JKQTPBarVerticalGraph>' requested here
| (IsGadgetHelper<T>::IsGadgetOrDerivedFrom ? QMetaType::IsGadget : 0)
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:2367:21: note: in instantiation of template class 'QtPrivate::QMetaTypeTypeFlags<JKQTPBarVerticalGraph>' requested here
/*.flags=*/ QMetaTypeTypeFlags<T>::Flags,
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:2494:48: note: in instantiation of static data member 'QtPrivate::QMetaTypeInterfaceWrapper<JKQTPBarVerticalGraph>::metaType' requested here
return &QMetaTypeInterfaceWrapper<Ty>::metaType;
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:2538:16: note: in instantiation of function template specialization 'QtPrivate::qTryMetaTypeInterfaceForType<qt_meta_stringdata_JKQTPBarVerticalGraph_t, QtPrivate::TypeAndForceComplete<JKQTPBarVerticalGraph, std::integral_constant<bool, true>>>' requested here
QtPrivate::qTryMetaTypeInterfaceForType<Unique, T>()...
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/moc_jkqtpbarchart.cpp:95:1: note: in instantiation of variable template specialization 'qt_incomplete_metaTypeArray<qt_meta_stringdata_JKQTPBarVerticalGraph_t, QtPrivate::TypeAndForceComplete<JKQTPBarVerticalGraph, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<int, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<unsigned long, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<int, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<unsigned long, std::integral_constant<bool, false>>>' requested here
qt_incomplete_metaTypeArray<qt_meta_stringdata_JKQTPBarVerticalGraph_t
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/./jkqtplotter/jkqtpgraphsbasestylingmixins.h:49:9: note: member found by ambiguous name lookup
Q_GADGET
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:193:18: note: expanded from macro 'Q_GADGET'
#define Q_GADGET Q_GADGET_EXPORT()
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:182:10: note: expanded from macro 'Q_GADGET_EXPORT'
void qt_check_for_QGADGET_macro(); 
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/./jkqtplotter/jkqtpgraphsbasestylingmixins.h:396:9: note: member found by ambiguous name lookup
Q_GADGET
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:193:18: note: expanded from macro 'Q_GADGET'
#define Q_GADGET Q_GADGET_EXPORT()
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:182:10: note: expanded from macro 'Q_GADGET_EXPORT'
void qt_check_for_QGADGET_macro(); 
^
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/mocs_compilation.cpp:2:
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/moc_jkqtpbarchart.cpp:10:
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/../../graphs/jkqtpbarchart.h:25:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtGui.framework/Headers/QPainter:1:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtGui.framework/Headers/qpainter.h:48:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtGui.framework/Headers/qpixmap.h:48:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qsharedpointer.h:48:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qsharedpointer_impl.h:65:
In file included from /Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qobject.h:54:
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:872:49: error: member 'qt_check_for_QGADGET_macro' found in multiple base classes of different types
IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *),
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:1189:25: note: in instantiation of template class 'QtPrivate::IsGadgetHelper<JKQTPBarVerticalErrorGraph>' requested here
| (IsGadgetHelper<T>::IsGadgetOrDerivedFrom ? QMetaType::IsGadget : 0)
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:2367:21: note: in instantiation of template class 'QtPrivate::QMetaTypeTypeFlags<JKQTPBarVerticalErrorGraph>' requested here
/*.flags=*/ QMetaTypeTypeFlags<T>::Flags,
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:2494:48: note: in instantiation of static data member 'QtPrivate::QMetaTypeInterfaceWrapper<JKQTPBarVerticalErrorGraph>::metaType' requested here
return &QMetaTypeInterfaceWrapper<Ty>::metaType;
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qmetatype.h:2538:16: note: in instantiation of function template specialization 'QtPrivate::qTryMetaTypeInterfaceForType<qt_meta_stringdata_JKQTPBarVerticalErrorGraph_t, QtPrivate::TypeAndForceComplete<JKQTPBarVerticalErrorGraph, std::integral_constant<bool, true>>>' requested here
QtPrivate::qTryMetaTypeInterfaceForType<Unique, T>()...
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/moc_jkqtpbarchart.cpp:204:1: note: in instantiation of variable template specialization 'qt_incomplete_metaTypeArray<qt_meta_stringdata_JKQTPBarVerticalErrorGraph_t, QtPrivate::TypeAndForceComplete<JKQTPBarVerticalErrorGraph, std::integral_constant<bool, true>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<int, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<unsigned long, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<int, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<void, std::integral_constant<bool, false>>, QtPrivate::TypeAndForceComplete<unsigned long, std::integral_constant<bool, false>>>' requested here
qt_incomplete_metaTypeArray<qt_meta_stringdata_JKQTPBarVerticalErrorGraph_t
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/./jkqtplotter/jkqtpgraphsbasestylingmixins.h:49:9: note: member found by ambiguous name lookup
Q_GADGET
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:193:18: note: expanded from macro 'Q_GADGET'
#define Q_GADGET Q_GADGET_EXPORT()
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:182:10: note: expanded from macro 'Q_GADGET_EXPORT'
void qt_check_for_QGADGET_macro(); 
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/./jkqtplotter/jkqtpgraphsbasestylingmixins.h:396:9: note: member found by ambiguous name lookup
Q_GADGET
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:193:18: note: expanded from macro 'Q_GADGET'
#define Q_GADGET Q_GADGET_EXPORT()
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:182:10: note: expanded from macro 'Q_GADGET_EXPORT'
void qt_check_for_QGADGET_macro(); 
^
/Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/./jkqtplotter/jkqtpgraphsbaseerrors.h:315:9: note: member found by ambiguous name lookup
Q_GADGET
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:193:18: note: expanded from macro 'Q_GADGET'
#define Q_GADGET Q_GADGET_EXPORT()
^
/Users/runner/work/md-pdf/Qt/6.3.1/macos/lib/QtCore.framework/Headers/qtmetamacros.h:182:10: note: expanded from macro 'Q_GADGET_EXPORT'
void qt_check_for_QGADGET_macro(); 
^
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/mocs_compilation.cpp:2:
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/moc_jkqtpbarchart.cpp:10:
In file included from /Users/runner/work/md-pdf/md-pdf/3rdparty/JKQtPlotter/lib/jkqtplotter/JKQTPlotterSharedLib_autogen/XT4CMLABNO/../../graphs/jkqtpbarchart.h:25:

我没有MacOS来解决这个问题。也许有人知道怎么修?谢谢。

要重现此错误,只需MOC并使用Clang构建以下头文件:

#pragma once
#include <QObject>

class Gadget1 {
Q_GADGET
};
class Gadget2 {
Q_GADGET
};
class Object1
:   public QObject
{
Q_OBJECT
};
class Check
:   public Object1
,   public Gadget1
,   public Gadget2
{
Q_OBJECT
};

好,这是使用Clang构建时Qt6的问题。Qt Bug已被确认。所以我决定把这样的答案贴出来。

相关内容

  • 没有找到相关文章

最新更新