Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mixed Qt4 and Qt5 lib on Ubuntu crash my program (I think...)
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 4.5k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    nvcnvn
    wrote on last edited by
    #1

    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)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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).

      (Z(:^

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nvcnvn
        wrote on last edited by
        #3

        [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

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          OK, maybe I've missed it.

          (Z(:^

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Check whether one of your dependencies uses Qt 4

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nvcnvn
              wrote on last edited by
              #6

              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!

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                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.

                (Z(:^

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nvcnvn
                  wrote on last edited by
                  #8

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

                  1 Reply Last reply
                  0

                  • Login

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