Mixed Qt4 and Qt5 lib on Ubuntu crash my program (I think...)



  • I'm on Ubuntu 12.10 and 13.04, and get the same issue: http://pastebin.com/raw.php?i=ekCR323K
    I see some Qt 4 lib in the error output (I they come with Ubuntu install). So I think that maybe the issue...
    If the issue is about mixing the lib, I hope you can show me the way to enforce build with Qt 5 lib only!
    Thanks!

    Here is my project https://github.com/kidstuff/FastScoring - you need OpenCV 2.4.3 and pkg-config to build (It was work fine with Qt4)

    Here is my original question on Stack Overflow: http://stackoverflow.com/questions/17948723/mixed-qt4-and-qt5-lib-on-ubuntu-crash-my-program (in case you want get some reputation :D)


  • Moderators

    You don't include "widgets" module in your GUI:
    @
    QT += gui widgets
    @

    It is required in Qt5 when you use QtWidgets. Runtime mixing of libraries may be due to incorrect path or Qt4 plugins getting in the way. First, try running from Qt Creator to see if it works at all. Then experiment with LD_LIBRARY_PATH to import Qt5, and clean all plugin variables (run env in terminal to see what might be pointing to Qt4).



  • [quote author="sierdzio" date="1375250414"]You don't include "widgets" module in your GUI:[/quote]
    I think I have:
    @
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    @

    I will try the LD_LIBRARY_PATH


  • Moderators

    OK, maybe I've missed it.


  • Lifetime Qt Champion

    Hi,

    Check whether one of your dependencies uses Qt 4



  • Hi,
    I run the command: $ ldd appname
    and get these:
    @
    ...
    libQtOpenGL.so.4 => /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4 (0x00007f07bb397000)
    libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007f07ba6ea000)
    libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f07ba219000)
    libQtTest.so.4 => /usr/lib/x86_64-linux-gnu/libQtTest.so.4 (0x00007f07b9ff4000)
    ...
    @
    I'm not sure id libQtOpenGL.so.4 is v4 lib or not!?
    I set the LD_LIBRARY_PATH in Qt Creator to my Qt5 lib folder but It seem doesn't help!
    Can you tell me how do I exclude /usr/lib/ from my build config... I never do that before :D
    Thanks!


  • Moderators

    This is most probably included by some plugin, not your code. Have you compiled Qt with GTK style?

    In Qt5 your app links against libQt5libraryname.so.5, not libQtlibraryname.so.4. Names are clearly different and there should be no clash.

    Please check QT_PLUGIN_PATH.



  • OK, now I think I know what happen...
    I build my opencv with Qt4!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.