Important: Please read the Qt Code of Conduct -

Cannot mix incompatible Qt library

  • Hello!

    Recently, I have fiddled around and made some projects for my Linux (ubuntu) server. I would like to keep the installations of the tool(s) as simple/small as possible. So, what I do is create Qt C++ console application(s), upload them with FTP and use the ldd command to check which libraries are missing and fetch those from the Qt designer installation, upload them into /usr/local/lib and use ldconfig. Until now that has been working perfectly fine for me.

    I now have a project which should connect to a local database, so I added QT += SQL to my project file. And on my qtCreator VM (Ubuntu desktop) this all seemed to work fine. I uploaded the project to my sever, searched-up the and installed it.

    Now when running the application, I was expecting a message about installing the appropriate drivers. But actually I'm getting the following output (after a few qDebug lines...):

    • Cannot mix incompatible Qt library (version 0x50701) with this library (version 0x50a01)

    Strange thing is that I (believe) everything should be Qt 5.7.1, but it seems like something wants to mix with something of version 5.10.1

    What would be the best way to find out which library/application is at fault there? These libraries have been working for other apps, so my guess would be the SQL library... but when I replace it with a complete different one, the first version-value in the message changes ("cannot mix.... version 0x040602.... version 0x50a01").

    Thank you for your thoughts!

  • Qt Champions 2019

    @Maikie130 Did you try ldd again on your executable after copying the SQL Qt lib? And also ldd on that lib?

  • @jsulm: Yes I did, not sure if I interpret it well:

    $ ldd QtDatabaseTest
   =>  (0x00007ffc005db000)
   => /usr/local/lib/ (0x00007fe39106f000)
   => /usr/local/lib/ (0x00007fe390e2a000)
   => /usr/local/lib/ (0x00007fe3906da000)
   => /usr/lib/x86_64-linux-gnu/ (0x00007fe390358000)
   => /lib/x86_64-linux-gnu/ (0x00007fe390142000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38fd78000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38fb5b000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38f941000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38f638000)
   => /usr/local/lib/ (0x00007fe38f19f000)
   => /usr/local/lib/ (0x00007fe38ede7000)
   => /usr/local/lib/ (0x00007fe38d404000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38d200000)
   => /usr/lib/x86_64-linux-gnu/ (0x00007fe38cffe000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38cced000)
            /lib64/ (0x00007fe391405000)
   => /lib/x86_64-linux-gnu/ (0x00007fe38ca7d000)
    $ ldd /usr/local/lib/
   =>  (0x00007ffde4db4000)
   => /usr/local/lib/ (0x00007ff4c47b0000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c4593000)
   => /usr/lib/x86_64-linux-gnu/ (0x00007ff4c4211000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c3f08000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c3cf2000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c3928000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c370e000)
   => /usr/local/lib/ (0x00007ff4c3275000)
   => /usr/local/lib/ (0x00007ff4c2ebd000)
   => /usr/local/lib/ (0x00007ff4c14da000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c12d6000)
   => /usr/lib/x86_64-linux-gnu/ (0x00007ff4c10d4000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c0dc3000)
            /lib64/ (0x00007ff4c5145000)
   => /lib/x86_64-linux-gnu/ (0x00007ff4c0b53000)

  • Qt Champions 2019

    @Maikie130 Looks good

  • Moderators

    @Maikie130 when you say you simply copy the libs from qtcreator do you mean the libs found in Qt/Tools/QtCreator/......
    or the ones found in

    if the former, than chances are you were copying the wrong files all along.

  • @J.Hilk I have been copying them from the following folder: '/home/<user>/Qt/5.7/gcc_64' So, I suppose that is the latter.

  • Moderators

    @Maikie130 ok that at least should be correct ;-)

  • Lifetime Qt Champion


    Did you also copy the corresponding SQL plugins ?

  • You probably don't want to copy libraries for one Application into /usr/local/lib, since everything on the system can pick up libraries there.

    That said, check out:
    It's a utility for automagically gathering up Linux library dependencies and setting up their search path so an app can run conveniently out of a self contained directory. There is even a plugin for linuxdeploy to grab secondary Qt dependencies like SQL driver plugins that get loaded at runtime that don't show up with a utility like ldd.

  • @SGaist Thanks for the thought! I didn't, so fixed that now... Still the same message however :c

    @wrosecrans It sounds really good (that said, I actually wanted to install them globally, as I have multiple tools running of the same libs. Is this bad practice?), I have fiddled around with it for some time now, but I can't really seem to be getting it to work. What I did is clone the git repo, fix one million dependencies and ran cmake/make on it. I do have the executable now, but I am unsure about how to use it (also, the qt-plugin doesn't want to compile due to missing dependencies, which are a pain to gather around). I must admit that I am quite new to the whole git/cmake/etc, so sorry for the nuisance.

    @jsulm & @J-Hilk thanks for checking!

  • Lifetime Qt Champion

    Then install your custom version of Qt in a clearly dedicated folder and use RPATH to ensure your applications are looking in the right folders to get your custom Qt version.

  • @SGaist Thanks for the tip, I did this and used ldd again to fix teh paths to the new directory. Seems like the Qt core lib was 5.10, which (probably?) wasn't a problem for the other tools, but in combination with the SQL plugin it gave me that error.

  • @Maikie130 If you have many tools, you can toss them all in the bin dir of one big AppDir made by linuxdeploy. For example, /opt/maiki/usr/bin and everything in that bin dir will get set with rpath by linuxdeploy to look for libraries in /opt/maikie/usr/lib, but nothing else on the system will get impacted by those libraries, so you don't have to duplicate but you can easily accumulate stuff in that appdir that is easy to move to your server.

    The qt plugin has binarties published, so you can just use that rather than building it from source. They use the same appdir style of bundling everything into an image, so you can just grab the binary, chmod it +x and use it.