Qt World Summit: Register Today!

Distribution issues under Linux caused by library version conflict

  • Hi all,

    I'm facing a pesky distribution issue of a Qt5 app under Linux, and I was hoping to get some help.

    I've packaged an application set to be installed on /opt/MYAPP/, which worked on Qt 5.1 on various Linux systems last year. However, I've recently upgraded to Qt 5.5 and recompiled my app. Using the same procedure as before, on more recent distributions including Ubuntu 14.04, the app refuses to run.

    I've narrowed it down to a library version conflict. I ship all copies of the required Qt 5.5 libs and store them in /opt/MYAPP/libs. I can confirm through ldd that my app correctly fetches these files. I've also placed the platform plugin in the required platforms/ subdirectory. However, Ubuntu 14.04 and others ship with Qt 5.4, and for some reason my copy of libQt5XcbQpa.so.5 eventually tries to load dependencies from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 instead of the provided ones.

    Here's a full GDB backtrace illustrating the jump, from frames 10 to 9:

    #0 0x00007ffff0700cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
    #1 0x00007ffff07040d8 in __GI_abort () at abort.c:89
    #2 0x00007ffff17c60be in QMessageLogger::fatal(char const*, ...) const ()
    from /opt/MYAPP/lib/libQt5Core.so.5
    #3 0x00007ffff19f142d in QObjectPrivate::QObjectPrivate(int) () from /opt/MYAPP/lib/libQt5Core.so.5
    #4 0x00007fffe7b787eb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
    #5 0x00007fffe7b7b8df in QDBusAbstractInterface::QDBusAbstractInterface(QString const&, QString const&, char const*, QDBusConnection const&, QObject*) () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
    #6 0x00007fffe7b61cbe in QDBusConnectionInterface::QDBusConnectionInterface(QDBusConnection const&, QObject*) () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
    #7 0x00007fffe7b5d049 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
    #8 0x00007fffe7b5e423 in QDBusConnection::connectToBus(QDBusConnection::BusType, QString const&) ()
    from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
    #9 0x00007fffe7b5e559 in QDBusConnection::sessionBus() () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
    #10 0x00007fffe89aaf5a in ?? () from /opt/MYAPP/lib/libQt5XcbQpa.so.5
    #11 0x00007fffe89a1d12 in ?? () from /opt/MYAPP/lib/libQt5XcbQpa.so.5
    #12 0x00007fffe892d0de in QXcbIntegration::accessibility() const ()
    from /opt/MYAPP/lib/libQt5XcbQpa.so.5
    #13 0x00007ffff24dc53c in QAccessible::isActive() () from /opt/MYAPP/lib/libQt5Gui.so.5
    #14 0x00007ffff24dc6fc in QAccessible::updateAccessibility(QAccessibleEvent*) ()
    from /opt/MYAPP/lib/libQt5Gui.so.5
    #15 0x00007ffff2e714a8 in QAbstractButton::setChecked(bool) () from /opt/MYAPP/lib/libQt5Widgets.so.5
    #16 0x00007ffff31002a8 in ?? () from /opt/MYAPP/lib/libQt5Widgets.so.5
    #17 0x00007ffff31004a2 in QAbstractButton::qt_metacall(QMetaObject::Call, int, void**) ()
    from /opt/MYAPP/lib/libQt5Widgets.so.5
    #18 0x00007ffff2f31ba5 in QToolButton::qt_metacall(QMetaObject::Call, int, void**) ()
    from /opt/MYAPP/lib/libQt5Widgets.so.5
    #19 0x00007ffff19d36a5 in QMetaProperty::write(QObject*, QVariant const&) const ()
    from /opt/MYAPP/lib/libQt5Core.so.5
    #20 0x00007ffff19fc43f in QObject::setProperty(char const*, QVariant const&) ()
    from /opt/MYAPP/lib/libQt5Core.so.5
    #21 0x000000000089f6ef in ?? ()
    #22 0x0000000000884f9f in ?? ()
    #23 0x000000000089616d in ?? ()
    #24 0x00000000008a19af in ?? ()
    #25 0x000000000088555e in ?? ()
    #26 0x000000000088b12d in ?? ()
    #27 0x000000000088d918 in ?? ()
    #28 0x00000000008a1b77 in ?? ()
    #29 0x0000000000896414 in ?? ()
    #30 0x00000000008a19af in ?? ()
    #31 0x000000000088555e in ?? ()
    #32 0x000000000088b12d in ?? ()
    #33 0x000000000088d918 in ?? ()
    #34 0x00000000008a1b77 in ?? ()
    #35 0x0000000000896414 in ?? ()
    #36 0x00000000008a19af in ?? ()
    #37 0x000000000088555e in ?? ()
    #38 0x000000000088ae69 in ?? ()
    #39 0x00000000008854f6 in ?? ()
    #40 0x000000000088a898 in ?? ()
    #41 0x000000000052579f in ?? ()
    #42 0x00000000004b4a6d in ?? ()
    #43 0x00000000004b2a76 in ?? ()
    #44 0x0000000000519174 in ?? ()
    #45 0x0000000000511e2b in ?? ()
    #46 0x00000000004ea7cd in ?? ()
    #47 0x0000000000459c37 in ?? ()
    #48 0x00007ffff06ebec5 in __libc_start_main (main=0x459140, argc=1, argv=0x7fffffffe058,
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe048)
    at libc-start.c:287
    #49 0x000000000046c467 in ?? ()

    Some reading tells me that Qt 5.5 changed a few things about how platform plugins are loaded, although I have yet to understand if this applies to this situation or not. Online users suggest that I should uninstall the bundled version of Qt in Ubuntu, which is not acceptable as I'm looking to deploy this app on several PCs in our company. Distros that don't come with Qt can run the software just fine.

    Note that it also works if I run my app using the following command, so I know I'm including all the required libs:

    Thanks in advance for any insights you might have!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Check that all dependencies of your application are correctly looking for their own dependencies in your application folder.

  • To add to @SGaist above, it's the dependency of the platform plugin dll libqxcb.so that's changed between 5.4 and 5.5. While you've placed the plugin file correctly (as usual) in the platforms subdirectory, the chrpath of it now matters (in versions of Qt before 5.5 the chrpath setting of the plugin files were immaterial).

    So, try go to your platform subdirectory and type:

    sudo apt-get install chrpath
    chrpath -r \$ORIGIN/.. libqxcb.so

    Now try to launch your app.

    (The first line is just to install the chrpath utility).
    The 2nd line should show this output:

    libqxcb.so: RUNPATH=$ORIGIN/../../lib
    libqxcb.so: new RUNPATH: $ORIGIN/..

    That setting $ORIGIN/../../lib is tuned for fetching the files correctly from 5.5's installation directory, but not for a distribution setup. I can write more/explain more if you want :-)

    EDIT: I assumed that your platforms subdirectory is /opt/MYAPP/lib/platforms, but if it's /opt/MYAPP/platforms you need to change the chrpath command to
    chrpath -r \$ORIGIN/../lib libqxcb.so

  • The above is exactly what I did: using chrpath to change the properties of libqxcb.so, but I'm still in the same situation. I double-confirmed this using ldd (all Qt references are now correct), and even performed a full reinstall. No change, unfortunately.

    With that said, hskoglund, your blog posts helped me clarify many of the steps to get to this point, and why things work the way they do, so thanks for your clear explanations!

  • Lifetime Qt Champion

    Check also the dependencies of libqxcb, IIRC there's a new lib since 5.5

Log in to reply