-
Bug
-
Resolution: Unresolved
-
P2: Important
-
5.14.2, 5.15.2
-
None
-
Ubuntu 18.04
I'm not convinced this is actually a bug - it feels more like a configuration issue, but I've spent 3 days trying to get to the bottom of it and also posted a question on the forum with no joy (https://forum.qt.io/topic/123037/strange-undefined-reference-link-errors-on-ubuntu-static-build).
I'm using Cmake to build a 'desktop' QML app against a static version of Qt 5.15.2 (I've also tried with 5.14.2).
This app builds and runs fine on macOS and Windows (both also using a static Qt build).
I have created a static build of Qt from source on Ubuntu 18.04 (also tried 16.x). This build is fine and the Qt examples build and run as expected.
However my app will not build under Ubuntu. The compilation is good but at link time there are loads of 'undefined references', which mainly appear to be related to QtQuickControls2 code.
I have isolated this to the inclusion of `import QtQuick.Controls 2.15`. E.g. the app will build, link and run fine until I add `import QtQuick.Controls 2.15` to any QML file.
Note that I am including all the relevant Q_IMPORT_PLUGIN and link library statements - to reiterate the exact same code builds and runs fine on macOS and Windows machines. What's more, as is seen from the output below, the undefined references are actually originating from `qtquickcontrols2plugin.cpp`.
Does anybody have any insight into what might be causing this?
This is just a sample of the link error output:
/home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `QtQuickControls2Plugin::~QtQuickControls2Plugin()': qtquickcontrols2plugin.cpp:(.text._ZN22QtQuickControls2PluginD2Ev+0x19): undefined reference to `QQuickStylePrivate::reset()' qtquickcontrols2plugin.cpp:(.text._ZN22QtQuickControls2PluginD2Ev+0x22): undefined reference to `QQuickStylePlugin::~QQuickStylePlugin()' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `QtQuickControls2Plugin::~QtQuickControls2Plugin()': qtquickcontrols2plugin.cpp:(.text._ZN22QtQuickControls2PluginD0Ev+0x19): undefined reference to `QQuickStylePrivate::reset()' qtquickcontrols2plugin.cpp:(.text._ZN22QtQuickControls2PluginD0Ev+0x21): undefined reference to `QQuickStylePlugin::~QQuickStylePlugin()' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `QtQuickControls2Plugin::registerTypes(char const*)::\{lambda(QQmlEngine*, QJSEngine*)#61}::_FUN(QQmlEngine*, QJSEngine*)': qtquickcontrols2plugin.cpp:(.text._ZZN22QtQuickControls2Plugin13registerTypesEPKcENUlP10QQmlEngineP9QJSEngineE59_4_FUNES3_S5_+0x14): undefined reference to `QQuickColor::QQuickColor(QObject*)' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `void QQmlPrivate::createInto<QQuickPaddedRectangle>(void*)': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate10createIntoI21QQuickPaddedRectangleEEvPv[_ZN11QQmlPrivate10createIntoI21QQuickPaddedRectangleEEvPv]+0x7): undefined reference to `QQuickPaddedRectangle::QQuickPaddedRectangle(QQuickItem*)' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `void QQmlPrivate::createInto<QQuickTumblerView>(void*)': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate10createIntoI17QQuickTumblerViewEEvPv[_ZN11QQmlPrivate10createIntoI17QQuickTumblerViewEEvPv]+0x7): undefined reference to `QQuickTumblerView::QQuickTumblerView(QQuickItem*)' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `QQmlPrivate::QQmlElement<QQuickTumblerView>::~QQmlElement()': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate11QQmlElementI17QQuickTumblerViewED2Ev[_ZN11QQmlPrivate11QQmlElementI17QQuickTumblerViewED5Ev]+0x20): undefined reference to `vtable for QQuickTumblerView' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `non-virtual thunk to QQmlPrivate::QQmlElement<QQuickTumblerView>::~QQmlElement()': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate11QQmlElementI17QQuickTumblerViewED2Ev[_ZN11QQmlPrivate11QQmlElementI17QQuickTumblerViewED5Ev]+0x7c): undefined reference to `vtable for QQuickTumblerView' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `void QQmlPrivate::createInto<QQuickClippedText>(void*)': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate10createIntoI17QQuickClippedTextEEvPv[_ZN11QQmlPrivate10createIntoI17QQuickClippedTextEEvPv]+0x7): undefined reference to `QQuickClippedText::QQuickClippedText(QQuickItem*)' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `QQmlPrivate::QQmlElement<QQuickClippedText>::~QQmlElement()': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate11QQmlElementI17QQuickClippedTextED2Ev[_ZN11QQmlPrivate11QQmlElementI17QQuickClippedTextED5Ev]+0x20): undefined reference to `vtable for QQuickClippedText' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `non-virtual thunk to QQmlPrivate::QQmlElement<QQuickClippedText>::~QQmlElement()': qtquickcontrols2plugin.cpp:(.text._ZN11QQmlPrivate11QQmlElementI17QQuickClippedTextED2Ev[_ZN11QQmlPrivate11QQmlElementI17QQuickClippedTextED5Ev]+0x6c): undefined reference to `vtable for QQuickClippedText' /home/nuc/dev/qt-static-release/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.a(qtquickcontrols2plugin.o): In function `QQmlPrivate::QQmlElement<QQuickPlaceholderText>::~QQmlElement()':