Build fails with Qt 6.3 and clang
Hello!
Thanks for a great library. I have been using it for a while with Qt 6.3 and g++ without any issues. Recently I tried to switch my project's build system to clang and I started seeing the following build error:
[13/176] Building CXX object lib/quickqanava/src/CMakeFiles/QuickQanava.dir/QuickQanava_autogen/mocs_compilation.cpp.o
FAILED: lib/quickqanava/src/CMakeFiles/QuickQanava.dir/QuickQanava_autogen/mocs_compilation.cpp.o
/usr/bin/clang++ -DMM_CMAKE_PROJECT_VERSION=\"0.6.0\" -DQT_CORE_LIB -DQT_DISABLE_DEPRECATED_BEFORE=0x050F00 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_DEBUG -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQUICKQANAVA_STATIC -I/tmp/project/build/lib/quickqanava/src -I/tmp/project/lib/quickqanava/src -I/tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/include -I/tmp/project/lib/quickqanava/QuickContainers/include -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtQuickControls2 -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtOpenGL -g -fcolor-diagnostics -fPIC -std=gnu++17 -MD -MT lib/quickqanava/src/CMakeFiles/QuickQanava.dir/QuickQanava_autogen/mocs_compilation.cpp.o -MF lib/quickqanava/src/CMakeFiles/QuickQanava.dir/QuickQanava_autogen/mocs_compilation.cpp.o.d -o lib/quickqanava/src/CMakeFiles/QuickQanava.dir/QuickQanava_autogen/mocs_compilation.cpp.o -c /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/mocs_compilation.cpp
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/mocs_compilation.cpp:2:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/moc_qanBehaviour.cpp:10:
In file included from /tmp/project/lib/quickqanava/src/./qanBehaviour.h:43:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanEdge.h:40:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanNode.h:43:
In file included from /tmp/project/lib/quickqanava/src/./gtpo/node.h:46:
In file included from /tmp/project/lib/quickqanava/src/./gtpo/./container_adapter.h:49:
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:262:33: error: no member named 'append' in 'qcm::adapter<QVector, qan::EdgeItem *>'
qcm::adapter<C, T>::append(_container, item);
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:419:20: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::append' requested here
_container.append(reinterpret_cast<typename Container::Item_type>(object));
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:394:16: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::appendImpl' requested here
return appendImpl( object, typename ItemDispatcher<typename Container::Item_type>::type{} );
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:264:14: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::append' requested here
explicit ContainerModelImpl(Container& container) :
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:152:26: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::ContainerModelImpl' requested here
_modelImpl = new ModelImpl{*this};
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:141:13: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::createModel' requested here
virtual ~Container() {
^
/tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanPortItem.h:65:13: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::~Container' requested here
virtual ~PortItem() override = default;
^
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/mocs_compilation.cpp:2:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/moc_qanBehaviour.cpp:10:
In file included from /tmp/project/lib/quickqanava/src/./qanBehaviour.h:43:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanEdge.h:40:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanNode.h:43:
In file included from /tmp/project/lib/quickqanava/src/./gtpo/node.h:46:
In file included from /tmp/project/lib/quickqanava/src/./gtpo/./container_adapter.h:49:
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:324:51: error: no member named 'indexOf' in 'qcm::adapter<QVector, qan::EdgeItem *>'
const auto itemIndex = qcm::adapter<C,T>::indexOf(_container, item);
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:441:20: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::removeAll' requested here
_container.removeAll(qobject_cast<typename Container::Item_type>(const_cast<QObject*>(object)));
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:399:13: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::removeImpl' requested here
removeImpl( object, typename ItemDispatcher<typename Container::Item_type>::type{} );
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:264:14: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::remove' requested here
explicit ContainerModelImpl(Container& container) :
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:152:26: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::ContainerModelImpl' requested here
_modelImpl = new ModelImpl{*this};
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:141:13: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::createModel' requested here
virtual ~Container() {
^
/tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanPortItem.h:65:13: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::~Container' requested here
virtual ~PortItem() override = default;
^
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/mocs_compilation.cpp:2:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/moc_qanBehaviour.cpp:10:
In file included from /tmp/project/lib/quickqanava/src/./qanBehaviour.h:43:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanEdge.h:40:
In file included from /tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanNode.h:43:
In file included from /tmp/project/lib/quickqanava/src/./gtpo/node.h:46:
In file included from /tmp/project/lib/quickqanava/src/./gtpo/./container_adapter.h:49:
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:334:32: error: no member named 'removeAll' in 'qcm::adapter<QVector, qan::EdgeItem *>'
qcm::adapter<C,T>::removeAll(_container, item);
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:436:89: error: no member named 'indexOf' in 'qcm::adapter<QVector, qan::EdgeItem *>'
inline auto indexOf( T item ) const noexcept -> int { return qcm::adapter<C, T>::indexOf(_container, item); }
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:485:47: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::indexOf' requested here
return ( item != nullptr ? _container.indexOf(qobject_cast<T>(item)) : -1 );
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:409:16: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::indexOfImpl' requested here
return indexOfImpl( item, typename ItemDispatcher<typename Container::Item_type>::type{} );
^
/tmp/project/lib/quickqanava/QuickContainers/include/qcmContainerModel.h:264:14: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::indexOf' requested here
explicit ContainerModelImpl(Container& container) :
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:152:26: note: in instantiation of member function 'qcm::ContainerModelImpl<qcm::Container<QVector, qan::EdgeItem *>>::ContainerModelImpl' requested here
_modelImpl = new ModelImpl{*this};
^
/tmp/project/lib/quickqanava/src/./gtpo/../../QuickContainers/include/qcmContainer.h:141:13: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::createModel' requested here
virtual ~Container() {
^
/tmp/project/build/lib/quickqanava/src/QuickQanava_autogen/EWIEGA46WW/../../../../../../lib/quickqanava/src/qanPortItem.h:65:13: note: in instantiation of member function 'qcm::Container<QVector, qan::EdgeItem *>::~Container' requested here
virtual ~PortItem() override = default;
^
4 errors generated.
ninja: build stopped: subcommand failed.
Seems very similar to this error encountered in #118.
Couple of useful information about my toolchain:
$ g++ --version
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)
$ clang++ --version
clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-pc-linux-gnu/12.1.0
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.0
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ cmake --version cmake version 3.23.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
... using Qt 6.3.1 Archlinux package with QuickQanava at 2f21d9b. I am building QuickQanava as a CMake target added via add_subdirectory. Any ideas would be welcome!
Hello, anybody here?
We might have a regression, I'am actually testing with 6.3 (and g++), probably you should comment #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) in qcmAdapter.h.
I will modify develop/master as soon as it is working on both g++/clang/msvc...
@petrmanek could you try last develop please, I have no way to compile with clang.
@cneben Just tried d547c9a9596966a55fe186b9ce769cbd48f58bc2 with the same toolchain. Under clang, the original error message has disappeared but a new one has emerged; please see below.
[47/100] Building CXX object samples/nodes/CMakeFiles/sample_nodes.dir/nodes.cpp.o
FAILED: samples/nodes/CMakeFiles/sample_nodes.dir/nodes.cpp.o
/usr/bin/clang++ -DQT_CORE_LIB -DQT_DISABLE_DEPRECATED_BEFORE=0x050F00 -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQUICKQANAVA_STATIC -I/tmp/QuickQanava/build/samples/nodes -I/tmp/QuickQanava/samples/nodes -I/tmp/QuickQanava/build/samples/nodes/sample_nodes_autogen/include -I/tmp/QuickQanava/samples/nodes/../../src -I/tmp/QuickQanava/samples/nodes/../../GTpo/src -I/tmp/QuickQanava/samples/nodes/../../QuickContainers/include -I/tmp/QuickQanava/samples/nodes/QuickQanava -I/tmp/QuickQanava/samples/nodes/Qt6::QuickControls2 -I/tmp/QuickQanava/src -I/tmp/QuickQanava/QuickContainers/include -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtQml -isystem /usr/include/qt6/QtQmlIntegration -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtQuickControls2 -isystem /usr/include/qt6/QtQuick -isystem /usr/include/qt6/QtQmlModels -isystem /usr/include/qt6/QtOpenGL -fPIE -fPIC -std=gnu++17 -MD -MT samples/nodes/CMakeFiles/sample_nodes.dir/nodes.cpp.o -MF samples/nodes/CMakeFiles/sample_nodes.dir/nodes.cpp.o.d -o samples/nodes/CMakeFiles/sample_nodes.dir/nodes.cpp.o -c /tmp/QuickQanava/samples/nodes/nodes.cpp
In file included from /tmp/QuickQanava/samples/nodes/nodes.cpp:41:
In file included from /tmp/QuickQanava/samples/nodes/../../src/QuickQanava.h:61:
/tmp/QuickQanava/samples/nodes/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
^
1 error generated.
Please note that I can see this popping out in multiple files. The error message looks exactly the same, so in the interest of brevity I am only sharing the first line of each message:
/tmp/QuickQanava/samples/nodes/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/edges/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/connector/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/groups/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/selection/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/style/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/style/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/style/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/dataflow/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/dataflow/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/dataflow/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/topology/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/topology/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
/tmp/QuickQanava/samples/topology/../../src/./qanAnalysisTimeHeatMap.h:130:21: error: 'geometryChanged' marked 'override' but does not override any member functions
@petrmanek, analysis heat map has been added very recently, sorry for that. It should be working now (latest develop). I will try to reproduce your environment with github actions.
@cneben Thanks! 3902d60a3722d34e7a7b1b1e91ec176fce34ad3d seems to compile well under clang now.
As a little bonus, I also tried compiling on the latest macOS Monterey (12.3.1) under clang 13.1.6. Everything works as expected, nicely done!
Closing this as solved. :+1:
Nice, thanks !