Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Strange 'undefined reference' link errors on Ubuntu static build
Forum Update on Monday, May 27th 2025

Strange 'undefined reference' link errors on Ubuntu static build

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 462 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Toby Ealden
    wrote on 24 Jan 2021, 09:28 last edited by
    #1

    I have a cmake built QML app that builds and runs fine on MacOS and Windows 10, but fails to build on Ubuntu 16.04 and 18.04.

    I'm building against a static build of 5.15.2 which I built from source. I have also tried 5.14.2 and it exhibits the same problem, and I have tried on 3 different machines.

    It feels like a configuration issue, or some problem with picking up old versions of libraries or something, but the examples that are built as part of the Qt installation, including the QtQuickControl2 apps like gallery build and run fine. They are obviously using the qmake build whereas I'm using cmake, I've tried examining the make output using VERBOSE=1 and I can't see any obvious missing link library or whatever.

    I'm working on creating a minimal example to reproduce the problem, but in the meantime
    the issue seems to revolve around QtQuickControls2. My app will build and run fine if I have a minimal QML, but as soon as I add import QtQuick.Controls 2.15 I get all these errors.

    I have the relevant target_link_libraries and Q_IMPORT_PLUGIN directives - as noted above the exact same repo builds and runs fine on MacOS and Windows running against static 5.15.2 Qt builds.

    Does anybody have any clues off the top of their heads?

    The link errors are:

    /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()':
    
    1 Reply Last reply
    0
    • T Offline
      T Offline
      Toby Ealden
      wrote on 25 Jan 2021, 14:33 last edited by
      #2

      OK, more clearly stated:

      Why would I be getting 'undefined reference' to 'private' Qt classes (e.g. QQuickStylePrivate::reset()) when linking with libqtquickcontrols2plugin.a?

      I have the following included in target_link_libararies:

      target_link_libraries(
          ${PROJECT_NAME}
          PRIVATE
          Qt5::Core
          Qt5::Network
          Qt5::Qml
          Qt5::Quick
          Qt5::QuickControls2
          Qt5::WebChannel
           ...
      )
      

      What library could be missing that includes these symbols?

      Any insights much appreciated...

      1 Reply Last reply
      0

      1/2

      24 Jan 2021, 09:28

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved