[SOLVED] Cannot compile with Qt5 (Qt4 working)



  • 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 toxcb_glx_get_convolution_filter'
    /usr/lib64/libGL.so: undefined reference to drmCloseOnce' /usr/lib64/libGL.so: undefined reference toxcb_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 ?


  • Lifetime Qt Champion

    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



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



  • 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 :)



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


  • Lifetime Qt Champion

    You're welcome !

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


Log in to reply
 

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