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. [SOLVED] Cannot compile with Qt5 (Qt4 working)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Cannot compile with Qt5 (Qt4 working)

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 4.1k 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.
  • D Offline
    D Offline
    dsant_fr
    wrote on last edited by
    #1

    Hello, I can not compile this simple example with Qt5, where with Qt4 it works :

    main.cpp :
    @#include <QApplication>
    #include <QPushButton>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QPushButton button ("Hello world !");
    button.show();
    return a.exec();
    }
    @

    prog.pro :
    @
    QT += widgets
    TEMPLATE = app
    DEPENDPATH += .
    INCLUDEPATH += .
    LIBS += -lz -ldl -lrt -lglib-2.0 -lpcre $(SUBLIBS) -L/usr/lib64 -L/lib64 -lQtCore -lpthread -lpng14 -lglib -lfreetype -lgobject-2.0 -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfontconfig -lXext -lX11 -lffi -luuid -lexpat -lxcb -lXau
    TARGET = run
    CONFIG += x86_64 static

    Input

    SOURCES += main.cpp
    @

    I installed Qt5 in /install, and run : @/install/qt51/5.1.0/gcc_64/bin/qmake@

    then "make" :
    @> make
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../install/qt51/5.1.0/gcc_64/mkspecs/linux-g++ -I. -I. -I../../../../install/qt51/5.1.0/gcc_64/include -I../../../../install/qt51/5.1.0/gcc_64/include/QtWidgets -I../../../../install/qt51/5.1.0/gcc_64/include/QtGui -I../../../../install/qt51/5.1.0/gcc_64/include/QtCore -I. -o main.o main.cpp
    g++ -Wl,-O1 -Wl,-rpath,/install/qt51/5.1.0/gcc_64 -Wl,-rpath,/install/qt51/5.1.0/gcc_64/lib -o run main.o -lz -ldl -lrt -lglib-2.0 -lpcre -L/usr/lib64 -L/lib64 -lQtCore -lpng14 -lglib -lfreetype -lgobject-2.0 -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfontconfig -lXext -lX11 -lffi -luuid -lexpat -lxcb -lXau -L/install/qt51//5.1.0/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libgthread-2.0.so.0, needed by /install/qt51//5.1.0/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libglapi.so.0, needed by /usr/lib64/libGL.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libXdamage.so.1, needed by /usr/lib64/libGL.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libX11-xcb.so.1, needed by /usr/lib64/libGL.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libxcb-glx.so.0, needed by /usr/lib64/libGL.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libXxf86vm.so.1, needed by /usr/lib64/libGL.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libdrm.so.2, needed by /usr/lib64/libGL.so, not found (try using -rpath or -rpath-link)
    /usr/lib64/libGL.so: undefined reference to xcb_glx_query_server_string_reply' /usr/lib64/libGL.so: undefined reference to _glapi_check_multithread'
    /usr/lib64/libGL.so: undefined reference to xcb_glx_get_pixel_mapuiv_data_length' /usr/lib64/libGL.so: undefined reference to xcb_glx_get_convolution_filter'
    /usr/lib64/libGL.so: undefined reference to drmCloseOnce' /usr/lib64/libGL.so: undefined reference to xcb_glx_get_query_objectiv_arb_data'
    @

    Note : compilation says "/install/qt51//5.1.0/gcc_64/lib/libQt5Core.so, not found", but the file exists :
    @-rwxr-xr-x 1 me users 4751504 Jul 27 18:24 /install/qt51/5.1.0/gcc_64/lib/libQt5Core.so.5.1.0@

    I think I have some missing DEPENDPATH, INCLUDEPATH and LIBS. What do you write in pro file for Qt5 ?

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

      Hi and welcome to devnet,

      It seems that your system is missing some libraries, look up the names of the missing libraries and install them

      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
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        bq. Note : it says “/install/qt51//5.1.0/gcc_64/lib/libQt5Core.so, not found”, but the file exists :

        No, the message is:

        bq. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libgthread-2.0.so.0, needed by /install/qt51//5.1.0/gcc_64/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)

        It helps to read all of an error message before deciding on a course of action. This missing library comes from glib.

        Remove the LIBS variable from your PRO file to eliminate problems you have deliberately introduced. Nothing in that variable should be required.
        "static" in CONFIG is not meaningful for the app TEMPLATE and "x86_64" is also not useful.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Code_ReaQtor
          wrote on last edited by
          #4

          bq. Note : it says “/install/qt51//5.1.0/gcc_64/lib/libQt5Core.so, not found”, but the file exists :
          bq. -rwxr-xr-x 1 me users 4751504 Jul 27 18:24 /install/qt51/5.1.0/gcc_64/lib/libQt5Core.so.5.1.0

          There is an extra "slash": .../qt51//5.1.0/...

          bq. /install/qt51//5.1.0/gcc_64/lib/libQt5Core.so

          bq. /install/qt51/5.1.0/gcc_64/lib/libQt5Core.so.5.1.0

          but not sure if this one really is the cause :)

          Please visit my open-source projects at https://github.com/Code-ReaQtor.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dsant_fr
            wrote on last edited by
            #5

            SOLVED :

            Here is the LIBS required with simple Qt5 hello world, in 64 bits on OpenSUSE :
            @LIBS += -L/usr/lib64 -L/lib64 -lgobject-2.0 -lglib-2.0 -lffi -lpcre -lrt -lX11 -ldl -lxcb -lgthread-2.0 -lglapi -lXext -lXdamage -lXfixes -lxcb-glx -lXxf86vm -ldrm -lXau -lX11-xcb@

            Thanks for your help.

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

              You're welcome !

              Can you also update the thread's title to solved so other forum users may know a solution has been found :)

              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

              • Login

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