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

Qt Creator on Linux Mint MATE can't find GL/gl.h



  • Kinda new to Qt Creator, was trying to Build the Qt Widgets Application Example. It has errors.
    First had to copy to user folder, OK no problem.
    Errors with QMessageBox::warning not enough parameters, fix all but the loadFile MessageBox.
    Added some Buttons, may not be correct but no error.
    Tried to Build but fatal error can't find GL/gl.h file ..
    /opt/Qt/6.0.0/gcc_64/include/QtGui/qopengl.h:141: error: GL/gl.h: No such file or directory
    In file included from /opt/Qt/6.0.0/gcc_64/include/QtGui/QtGui:60,
    from /opt/Qt/6.0.0/gcc_64/include/QtWidgets/QtWidgetsDepends:4,
    from /opt/Qt/6.0.0/gcc_64/include/QtWidgets/QtWidgets:3,
    from ../application/mainwindow.cpp:52:
    /opt/Qt/6.0.0/gcc_64/include/QtGui/qopengl.h:141:13: fatal error: GL/gl.h: No such file or directory
    141 | # include <GL/gl.h>
    | ^~~~~~~~~

    Anyone have any ideas?
    Thanks in advance.
    OtG


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You are missing the OpenGL development package for your distribution. You can use apt-get to install it through the command line.



  • @SGaist Thanks for the reply.
    I think I do ..
    donald@GW-SX2110G:~$ inxi -Fxzd
    System: Kernel: 5.4.0-58-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: MATE 1.24.0 Distro: Linux Mint 20 Ulyana
    base: Ubuntu 20.04 focal
    Machine: Type: Desktop Mobo: Gateway model: SX2110G v: 1.0A serial: <filter> UEFI: American Megatrends v: P11-A2
    date: 09/07/2012
    CPU: Topology: Dual Core model: AMD E1-1200 APU with Radeon HD Graphics bits: 64 type: MCP arch: Bobcat
    L2 cache: 512 KiB
    flags: lm nx pae sse sse2 sse3 sse4a ssse3 svm bogomips: 5588
    Speed: 777 MHz min/max: 777/1400 MHz Core speeds (MHz): 1: 780 2: 1178
    Graphics: Device-1: Advanced Micro Devices [AMD/ATI] Wrestler [Radeon HD 7310] vendor: Acer Incorporated ALI driver: radeon
    v: kernel bus ID: 00:01.0
    Display: x11 server: X.Org 1.20.8 driver: ati,radeon unloaded: fbdev,modesetting,vesa resolution: 1920x1080~60Hz
    OpenGL: renderer: AMD PALM (DRM 2.50.0 / 5.4.0-58-generic LLVM 10.0.0) v: 3.3 Mesa 20.0.8 direct render: Yes
    Audio: Device-1: Advanced Micro Devices [AMD/ATI] Wrestler HDMI Audio vendor: Acer Incorporated ALI driver: snd_hda_intel
    v: kernel bus ID: 00:01.1
    Device-2: Advanced Micro Devices [AMD/ATI] SBx00 Azalia vendor: Acer Incorporated ALI driver: snd_hda_intel
    v: kernel bus ID: 00:14.2
    Sound Server: ALSA v: k5.4.0-58-generic
    Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Acer Incorporated ALI driver: r8169
    v: kernel port: d000 bus ID: 06:00.0
    IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
    Drives: Local Storage: total: 465.76 GiB used: 106.34 GiB (22.8%)
    ID-1: /dev/sda vendor: Seagate model: ST500DM002-1BD142 size: 465.76 GiB
    Optical-1: /dev/sr0 vendor: ATAPI model: DVD A DH16ACSH rev: JA11 dev-links: cdrom,cdrw,dvd,dvdrw
    Features: speed: 48 multisession: yes audio: yes dvd: yes rw: cd-r,cd-rw,dvd-r,dvd-ram state: running
    Partition: ID-1: / size: 411.16 GiB used: 106.34 GiB (25.9%) fs: ext4 dev: /dev/sda2
    Sensors: System Temperatures: cpu: 56.4 C mobo: N/A gpu: radeon temp: 56 C
    Fan Speeds (RPM): N/A
    Info: Processes: 181 Uptime: 22m Memory: 7.49 GiB used: 3.06 GiB (40.8%) Init: systemd runlevel: 5 Compilers: gcc: 9.3.0
    clang: 10.0.0-4ubuntu1 Shell: bash v: 5.0.17 inxi: 3.0.38

    OtG


  • Lifetime Qt Champion

    These are your machine specs. What you are missing is the package that provides the headers and library for development. What you already have is the stuff to use OpenGL.



  • @SGaist Oh ok. Can you point me to where I can get them?
    FYI, I tried a NEW project when I try to Build ..
    Cannot find -lGLX
    Cannot find -lOpenGL

    Not sure what the char after the '-' is, looks like a lower case 'L'.
    Thanks for the help, really appreciate it.
    OtG


  • Lifetime Qt Champion

    Hi
    Normally its something like
    sudo apt install mesa-common-dev libglu1-mesa-dev



  • @mrjj said in Qt Creator on Linux Mint MATE can't find GL/gl.h:

    Hi
    Normally its something like
    sudo apt install mesa-common-dev libglu1-mesa-dev

    Thanks to the Qt Wiki I was able to get rid of the GLX error with those installs.
    Still get cannot find OpenGL and both Example Project and New Project fail to Build.
    Appreciate any ideas and will look over Wiki some more.
    Thanks
    OtG



  • Found this on Qt Wiki about OpenGL ..

    What should I do when Qt Creator complains about missing OpenGL support?

    Some parts of Qt Creator, such as the Design mode and QML Profiler, use Qt Quick 2, which relies on OpenGL API for drawing. Unfortunately, the use of OpenGL can cause problems, especially in remote setups and with outdated drivers. In these cases, Qt Creator displays OpenGL-related error messages on the console or records them in the Windows debugger log.

    Unix

    Run glxgears for a quick check whether OpenGL works in general. Check the output of glxinfo to get more details like the OpenGL driver and renderer (search for OpenGL in the application's output).

    If you are using the Mesa driver, you can force OpenGL to be rendered in software by setting the LIBGL_ALWAYS_SOFTWARE environment variable.

    Disabling plugins

    You can disable the Qt Creator plugins, at the expense of losing functionality:

    Launch Qt Creator from command line, with the -noload QmlProfiler -noload QuickDesigner arguments.
    Disable the plugins permanently by selecting Help > About Plugins.

    Did export LIBGL_ALWAYS_SOFTWARE=1, still error.
    Disabled Plugin QmlProfiler Could not find a QuickDesigner, still error

    env variable LIBGL_ALWAYS_SOFTWARE did not stay after reboot, not sure how to make stay.

    Any ideas guys?
    Thanks
    OtG


  • Lifetime Qt Champion

    @OscarTheGrouch See here: https://doc.qt.io/qt-5/linux.html
    And do

    sudo apt-get install build-essential libgl1-mesa-dev
    


  • @jsulm Thanks!
    That did the trick.
    OtG


Log in to reply