Building with Qt 5.2.0 under Ubuntu 12.04 compiler flags problem to resolve

  • Hi,

    Can anyone guess how to resolve next problem:

    When I build Qt 5.2.0 Widget application:

    I get:

    22:37:59: Running steps for project apptest2...
    22:37:59: Configuration unchanged, skipping qmake step.
    22:37:59: Starting: "/usr/bin/make"
    /home/paulcoder/Qt/5.2.0/gcc/bin/uic ../apptest2/mainwindow.ui -o ui_mainwindow.h
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../apptest2 -I../Qt/5.2.0/gcc/include -I../Qt/5.2.0/gcc/include/QtWidgets -I../Qt/5.2.0/gcc/include/QtGui -I../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o main.o ../apptest2/main.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../apptest2 -I../Qt/5.2.0/gcc/include -I../Qt/5.2.0/gcc/include/QtWidgets -I../Qt/5.2.0/gcc/include/QtGui -I../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o mainwindow.o ../apptest2/mainwindow.cpp
    /home/paulcoder/Qt/5.2.0/gcc/bin/moc -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../apptest2 -I../Qt/5.2.0/gcc/include -I../Qt/5.2.0/gcc/include/QtWidgets -I../Qt/5.2.0/gcc/include/QtGui -I../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. ../apptest2/mainwindow.h -o moc_mainwindow.cpp
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../Qt/5.2.0/gcc/mkspecs/linux-g++ -I../apptest2 -I../Qt/5.2.0/gcc/include -I../Qt/5.2.0/gcc/include/QtWidgets -I../Qt/5.2.0/gcc/include/QtGui -I../Qt/5.2.0/gcc/include/QtCore -I. -I. -I. -o moc_mainwindow.o moc_mainwindow.cpp
    g++ -Wl,-rpath,/home/paulcoder/Qt/5.2.0/gcc -Wl,-rpath,/home/paulcoder/Qt/5.2.0/gcc/lib -o apptest2 main.o mainwindow.o moc_mainwindow.o -L/home/paulcoder/Qt/5.2.0/gcc/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
    /usr/bin/ld: cannot find -lGL
    collect2: ld returned 1 exit status
    make: *** [apptest2] Error 1
    22:38:01: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project apptest2 (kit: Desktop Qt 5.2.0 GCC 32bit)
    When executing step 'Make'
    22:38:01: Elapsed time: 00:02.

    Using next Project Settings:

    qmake /home/paulcoder/apptest2/ -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug

    Please point me out what is -lGL and how can I fix the linking and maybe to change/modify the linker / compiler flags.

    Thank you,

  • Moderators

    I think "this post": is of interest for you. I had detailed out today how to solve -lGL for Ubuntu 13.10. It should be the same for 12.04

  • Dear koahnig,

    Plenty thanks for your above correct and useful guidance response message.
    After pre-installation of several libs acc. to the post I have succ. to qmake, build and run Qt widgets and QML projects under Ubuntu 12.04 using Qt 5.2.0 only version, however, when I switch to Qt 5.1.1 - Qt 5.0.2 I get next error while building:

    Project EROR: addExclusiveBuilds() requires at least two arguments

    when executing qmake.

    Could somebody guide briefly why such error and how to resolve it while building ?

    Thanks in advance on any regards within this topic.

  • Moderators

    Good to hear that your initial problem is solved.

    Are you using Qt creator when you switch Qt libs versions (e.g. to 5.1.1)?

  • When I switch the Qt versions ( e.g. from Qt 5.2.0 to Qt 5.1.1 down to Qt 5.0.2 ) I use the Qt Creator Projects tab when I have the sequence of the versions. I have checked also Build and Run -> Kits tab and found Qt 5.2.0 GCC 32 bit is detected as default. ( this is mainly not important details ).

    Please let me know why I get that "addExclusiveBuilds() requires at least two arguments" problem on Qt 5.0.2 - Qt 5.1.1 ?


  • Moderators

    I guess then that the other kits do not show any special icons under "Build&Run->Kits" and the same is true under "Qt Versions" and "Compilers".
    IIRC special icons are a yellow triangle with an exclamation mark and sometimes a red symbol.

    If all this is fine, I do not know where your problem could be.

  • What does it mean: “addExclusiveBuilds() requires at least two arguments” ?

    I think next writeup may provide some clarity:


    May one guess that by setting some of the mentioned above variables ( environment or internal ) one can resolve the problem ? I didn't get yet what exact variables and to what values to set, please briefly guide how to resolve the mentioned problem.

Log in to reply

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