Cannot mix incompatible Qt library...


Aspiring Daemon

Reaction score: 210
Messages: 675

Have you ever had a Qt based application that doesn't want to run, just after an upgrade of the said app?
If you type the executable in a command line, you might receive something like:
Cannot mix incompatible Qt library (xxxxx) with this library (xxxxx)

The easy solution is: pkg upgrade. It always works (or almost).

But what if you can't upgrade all your packages? I encounter this situation because of the great new xorg-server-1.20...

So, what's the problem exactly? If you search into Qt sources (Qt5 5.14.2 here), you will find in corelib/kernel/qobject_p.h this snippet:
    Catch mixing of incompatible library versions.
    Should be called from the constructor of every non-final subclass
    of QObjectPrivate, to ensure we catch incompatibilities between
    the intermediate base and subclasses thereof.
inline void QObjectPrivate::checkForIncompatibleLibraryVersion(int version) const
#if defined(QT_BUILD_INTERNAL)
    // Don't check the version parameter in internal builds.
    // This allows incompatible versions to be loaded, possibly for testing.
    if (Q_UNLIKELY(version != QObjectPrivateVersion)) {
        qFatal("Cannot mix incompatible Qt library (%d.%d.%d) with this library (%d.%d.%d)",
                (version >> 16) & 0xff, (version >> 8) & 0xff, version & 0xff,
                (QObjectPrivateVersion >> 16) & 0xff, (QObjectPrivateVersion >> 8) & 0xff, QObjectPrivateVersion & 0xff);

You can check the Qt dependencies of your app but you're unlikely to find where the problem lies. They all get upgraded with the upgrade of the app.

Nevertheless, from my understanding, as all father objects must check the version of the legacy ones, it means that, for instance, if qt5-gui is needed by your app, it uses itself qt5-network and qt5-dbus. So, if there are not of the same version than qt5-gui, you will receive this error.

The solution is to get upgrade for qtX-things that aren't of the same version than qtX-core (qt5-core for now).

pkg info | grep ^qt5

There are some exceptions like qt5-webkit, but you can try to upgrade it anyway.