Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

<GL/gl.h> not found in Linux



  • Hi!

    I have a 3D software developed in Qt , running 3D stuff working in Windows , Mac , Android and iOS , and they work lovely with Qt!
    Now i start to try compile it in Linux (To evaluate what is the best Host Platform for me...) , and in Linux in the first compilation i receive this error:

    /home/wolff/Qt/5.4/gcc_64/include/QtGui/qopengl.h:122:21: fatal error: GL/gl.h: No such file or directory

    include <GL/gl.h>

    Any idea of whatś happening?
    i have all in place including the QT+= flags and etc...but it not find the OpenGL headers.

    Another strange thing is the .pro file are not being recognized by the system to be oppened by QTCreator...

    Any help will be much appreciated.

    Kind Regards.


  • Lifetime Qt Champion

    Hi,

    You don't have the OpenGL dev package for your distribution installed.

    As for the pro file opening, it depends on your current desktop environment



  • Hi!

    i will try install a free Linux Version, since i´m using a Registered Enterprise package for mobile...maybe this is the problem...

    Kind Regards.



  • SGaist is right. You dont't have OpenGL dev package on your workstation.



  • Try to install libgl-dev.

    sudo apt-get install libgl-dev



  • Hi,
    I am trying to compile some QT examples under linux mint 18 and get the same errors. I am using the nvidia drivers. The QT Creator is from the standard repositories. Since many people seem to suffer from this, there are many solutions on the web. I tried these:

    sudo apt-get install libgl-dev
    sudo apt-get install mesa-common-dev
    sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl1-mesa-dev
    sudo apt-get install libxi-dev build-essential libdbus-1-dev libfontconfig1-dev libfreetype6-dev libx11-dev
    apt-get install libqt4-dev zlib1g-dev libqt4-opengl-dev

    and also made symbolic links, all to no avail. When I run: locate libGL I get this output:

    /usr/lib/libGL.so
    /usr/lib/chromium-browser/libGLESv2.so
    /usr/lib/i386-linux-gnu/libGLU.so.1
    /usr/lib/i386-linux-gnu/libGLU.so.1.3.1
    /usr/lib/i386-linux-gnu/mesa/libGL.so.1
    /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
    /usr/lib/nvidia-375/libGL.so
    /usr/lib/nvidia-375/libGL.so.1
    /usr/lib/nvidia-375/libGL.so.1.0.0
    /usr/lib/nvidia-375/libGLESv1_CM.so
    /usr/lib/nvidia-375/libGLESv1_CM.so.1
    /usr/lib/nvidia-375/libGLESv1_CM_nvidia.so.1
    /usr/lib/nvidia-375/libGLESv1_CM_nvidia.so.375.39
    /usr/lib/nvidia-375/libGLESv2.so
    /usr/lib/nvidia-375/libGLESv2.so.2
    /usr/lib/nvidia-375/libGLESv2_nvidia.so.2
    /usr/lib/nvidia-375/libGLESv2_nvidia.so.375.39
    /usr/lib/nvidia-375/libGLX.so
    /usr/lib/nvidia-375/libGLX.so.0
    /usr/lib/nvidia-375/libGLX_indirect.so.0
    /usr/lib/nvidia-375/libGLX_nvidia.so.0
    /usr/lib/nvidia-375/libGLX_nvidia.so.375.39
    /usr/lib/nvidia-375/libGLdispatch.so.0
    /usr/lib/x86_64-linux-gnu/libGL.so
    /usr/lib/x86_64-linux-gnu/libGLESv2.so
    /usr/lib/x86_64-linux-gnu/libGLEW.so
    /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13
    /usr/lib/x86_64-linux-gnu/libGLEW.so.1.13.0
    /usr/lib/x86_64-linux-gnu/libGLU.a
    /usr/lib/x86_64-linux-gnu/libGLU.so
    /usr/lib/x86_64-linux-gnu/libGLU.so.1
    /usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
    /usr/lib/x86_64-linux-gnu/mesa/libGL.so
    /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
    /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
    /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv1_CM.so.1
    /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv1_CM.so.1.1.0
    /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so
    /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2
    /usr/lib/x86_64-linux-gnu/mesa-egl/libGLESv2.so.2.0.0
    /usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so
    /usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1
    /usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1.0
    /usr/lib/x86_64-linux-gnu/qtcreator/libGLSL.so.1.0.0
    /usr/lib/x86_64-linux-gnu/qtcreator/plugins/libGLSLEditor.so
    /usr/lib32/libGL.so
    /usr/lib32/nvidia-375/libGL.la
    /usr/lib32/nvidia-375/libGL.so
    /usr/lib32/nvidia-375/libGL.so.1
    /usr/lib32/nvidia-375/libGL.so.1.0.0
    /usr/lib32/nvidia-375/libGLESv1_CM.so
    /usr/lib32/nvidia-375/libGLESv1_CM.so.1
    /usr/lib32/nvidia-375/libGLESv1_CM_nvidia.so.1
    /usr/lib32/nvidia-375/libGLESv1_CM_nvidia.so.375.39
    /usr/lib32/nvidia-375/libGLESv2.so
    /usr/lib32/nvidia-375/libGLESv2.so.2
    /usr/lib32/nvidia-375/libGLESv2_nvidia.so.2
    /usr/lib32/nvidia-375/libGLESv2_nvidia.so.375.39
    /usr/lib32/nvidia-375/libGLX.so
    /usr/lib32/nvidia-375/libGLX.so.0
    /usr/lib32/nvidia-375/libGLX_indirect.so.0
    /usr/lib32/nvidia-375/libGLX_nvidia.so.0
    /usr/lib32/nvidia-375/libGLX_nvidia.so.375.39
    /usr/lib32/nvidia-375/libGLdispatch.so.0
    /usr/local/MATLAB/R2016b/sys/opengl/lib/glnxa64/libGL.rights
    /usr/local/MATLAB/R2016b/sys/opengl/lib/glnxa64/libGL.so.1
    /usr/local/MATLAB/R2016b/sys/opengl/lib/glnxa64/libGL.so.1.6.0
    /usr/local/MATLAB/R2016b/sys/opengl/lib/glnxa64/libGLU.rights
    /usr/local/MATLAB/R2016b/sys/opengl/lib/glnxa64/libGLU.so.1
    /usr/local/MATLAB/R2016b/sys/opengl/lib/glnxa64/libGLU.so.1.3.1

    along with some steam and playonlinux stuff. My Matlab installation and steam work fine with OpenGL.
    It there anything I can do to resolve this?

    Regards,
    Stephan


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt did you install on your machine ?



  • Hi,
    Thanks for the response. From the standard Mint repositories, I installed this version:

    • Qt Creator 3.5.1

    • Based on Qt 5.5.1 (GCC 5.2.1 20151129, 64 bit)

    I notice that the error I get is slightly different from the one at the top of the topic: fatal error: QtOpenGL: No such file or directory but it appears to be related.

    Regards,
    Stephan


  • Lifetime Qt Champion

    I meant Qt itself not Qt Creator.

    If you didn't use the Qt installer then you should check the Qt 5 packages that you have installed in Ming. You might be missing some of them.



  • ah, sorry. I found this in the software manager:
    Qt5-default: 5.5.1+dfsg-16ubuntu7.2
    Libqt5qml5: 5.5.1-2ubuntu6
    Libqt5quick5: 5.5.1-2ubuntu6

    is this what you meant? Or can I run a command that reveals the correct version?

    regards,
    Stephan


  • Lifetime Qt Champion

    Then it's Qt 5.5.1.

    I don't know if Mint does any customisation for the packaging however AFAIK, from the ubuntu repo, you should install qt5-default which should install the basics for Qt 5 development.



  • I see that someone else had a similar problem with the mint version: https://forum.qt.io/topic/77370/problems-running-opengl-libraries/5
    I will try the installer from the website tomorrow.
    Thanks



  • Hi,
    I installed QT from the website, now the OpenGL example compiles without problems --> The Mint people seem to have packaged QT incorrectly.
    I do however get this warning when running the OpenGL example "boxes"

    This demo can be GPU and CPU intensive and may
    work poorly or not at all on your system.

    Is this a general warning? My system is capable enough, core i7 with nvidia gtx770

    Well, seems my problem is solved,
    Thanks, regards,
    Stephan


  • Lifetime Qt Champion

    What drivers are you using for your card ? The binary from nVidia ?



  • yes, the binary drivers, version 375.39 from the Mint repository :-)
    the example runs smooth and the CPU load is below 5%. The compile output suggests that OpenGL is working:
    22:57:54: Starting: "/usr/bin/make"
    gcc -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../boxes -I. -I/home/stephan/QT/5.8/gcc_64/include -I/home/stephan/QT/5.8/gcc_64/include/QtOpenGL -I/home/stephan/QT/5.8/gcc_64/include/QtWidgets -I/home/stephan/QT/5.8/gcc_64/include/QtGui -I/home/stephan/QT/5.8/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I/home/stephan/QT/5.8/gcc_64/mkspecs/linux-g++ -o fbm.o ../boxes/3rdparty/fbm.c
    g++ -c -pipe -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../boxes -I. -I/home/stephan/QT/5.8/gcc_64/include -I/home/stephan/QT/5.8/gcc_64/include/QtOpenGL -I/home/stephan/QT/5.8/gcc_64/include/QtWidgets -I/home/stephan/QT/5.8/gcc_64/include/QtGui -I/home/stephan/QT/5.8/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I/home/stephan/QT/5.8/gcc_64/mkspecs/linux-g++ -o glbuffers.o ../boxes/glbuffers.cpp

    and so on. Exits without warnings.


  • Lifetime Qt Champion

    Don't worry for that warning, it's a message that's currently shown whatever your hardware is. The example itself is pretty old and from a quick look there was a plan to only show it when hardware was underpowered but it seems it didn't happen yet.



  • Good to hear. All works well now, including bluetooth (which would have been my next question with the Mint package...)
    Thanks!


  • Lifetime Qt Champion

    You're welcome !

    Happy coding ! :)



  • This post is deleted!

Log in to reply