Ld -lGLerror in Qt 5.2 QtCreator 3.0 example ( serial enumerator example ) build
I'm trying to be intelligent in my first use of these forums re: QT and Ubunutu 13.10 tools.
So I am getting this tool (ld) error:
g++ -Wl,-rpath,/home/cwpr/Qt5.2.0/5.2.0/gcc -Wl,-rpath,/home/cwpr/Qt5.2.0/5.2.0/gcc/lib -o enumerator main.o -L/home/cwpr/Qt5.2.0/5.2.0/gcc/lib -lQt5Widgets -lQt5SerialPort -lQt5Gui -lQt5Core -lGL -lpthread
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: Leaving directory `/home/cwpr/Qt5.2.0/5.2.0/gcc/examples/serialport/build-enumerator-Desktop_Qt_5_2_0_GCC_32bit-Debug'
make: *** [enumerator] Error 1
11:57:03: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project enumerator (kit: Desktop Qt 5.2.0 GCC 32bit)
When executing step 'Make'
After some learning an ASSumption is that QT uses qmake which I beleive generates a makefile to use standard make.
And after man ld I believe the -lGL is trying to include GL which I equate to OpenGl, tho in the .pro and main.cpp I see no reference to OpenGL....
So with further searching on how to see if OpenGL is installed I did this command:
dpkg -l |egrep -i " GL |glx|opengl" which included this output:
ii libqt4-opengl:i386 4:4.8.4+dfsg-0ubuntu18.1 i386 Qt 4 OpenGL module
ii libqt5opengl5:i386 5.0.2+dfsg1-7ubuntu11.1 i386 Qt 5 OpenGL module
Now I am confused as it appears OpenGL "for" Qt is there....
What is my next teachable moment? |>)
QT5.2 was installed by offline .run from qt=project.org/download - ish.
After that QtCreator couldn't find compiler so my searching lead to:
sudo apt-get install build-essential which solved that problem and left me here....
Install libgl: @sudo apt-get install libgl1-mesa-dev@
Please search the forum, this question has been asked already many times and almost comes once per week.
Besides the missing OpenGL dev package "here":http://qt-project.org/wiki/Building_Qt_5_from_Git you can find a list of other dependencies you might have to install if you encounter other missing library errors. Even if the page is for building Qt, the informations are valuable
Thanks Zlatomir. Issue solved.
As for the varaitions on this question asked I looked at most of them and they assume knowledge I don't have yet, like why the Opengl listed on my system wasn't "good enough" or that I knew how or wanted to build libraries from source, install and configure them....
Thanks again Zlatomir.
It's not a problem of "good enough". What you got listed are the installed packages which had one of "GL |glx|opengl" in their name. The returned values where the packages corresponding to Qt's OpenGL modules (which make use of OpenGL) not any specific OpenGL library (the one you were missing)
As for the link I gave you, it's essentially informational (and might be useful if you have more libraries issue) The fact that it concerns building Qt is a detail, don't worry about that.
LE: SGaist was faster...
Well, more details can be found in the documentation, but a "high level" explanation is that the results of your searches are not actual opengl headers and libraries, but are Qt modules ("Qt 4":http://qt-project.org/doc/qt-4.8/qtopengl.html "Qt 5":http://qt-project.org/doc/qt-5/qtopengl-index.html) that more or less embed the opengl in an easier to use with Qt api, and those modules (and QML/Quick, and in Qt 5 i think widgets module also) need opengl development package to be installed on your system.
Thanks for your kind comments.
I will explore the apt / apt-get documentation to try and avoid asking how to get the actual libraries vs being fooled agin by the module interface / api wrappers listings...
I'll start with these links:
and look at getting the Synaptic tool.