Opengl for Ubuntu14 (building QT 5.4)

9,260

Solution 1

Ran into the same issue on Debian 8.5: Nvidia driver + all libs recommended in Building Qt5 from Git installed but configure step of Qt 5.9 failed cause of missing OpenGL support.

Excerpt:

  • Qt configure checks for openGL support by linking stuff against libGL.so - but the lib is missing
  • libGL.so is provided by libgl1-mesa-glx that adds a symlink from libGL.so to libGL.so.x.y.z (in my case libGL.so.1.2.0)
  • according to dpkg, libGL.so.1.2.0 is also part of libgl1-mesa-glx - but missing for 'reasons'
  • checking for other versions of libGL.so reveals that there is a library version installed by the Nvidia driver (/usr/lib/x86_64-linux-gnu/libGL.so.346.35)
  • adding a symlink to this file solved the issue

    sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.346.35 /usr/lib/x86_64-linux-gnu/libGL.so.1.2.0
    
  • re-run configure using the flag -recheck

Step by step procedure (can also be applied to similar issues):

$ ./configure -opensource -confirm-license -recheck -v 1>dump 2>&1
...
> grep 'libGL.so.*No' dump

> /usr/bin/ld.gold: error: cannot open /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so: No such file or directory
> /usr/bin/ld.gold: error: cannot open /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so: No such file or directory

$ ls -l /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so
lrwxrwxrwx 1 root root 14 Aug 19  2015 /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so -> libGL.so.1.2.0

libGL.so.1.2.0 is missing, check for provider...

$ dpkg -S libGL.so.1.2.0
libgl1-mesa-glx:amd64: /usr/lib/x86_64-linux-gnu/libGL.so.1.2.0

$ dpkg -l libgl1-mesa-glx
...
||/ Name                                     Version                   Architecture              Description
+++-========================================-=========================-=========================-=====================================================================================
ii  libgl1-mesa-glx:amd64                    10.3.2-1+deb8u1           amd64                     free implementation of the OpenGL API -- GLX runtime

So libgl1-mesa-glx library is installed but the libGL.so.1.2.0 is missing in the path. Check for other libGL.so* files...

$ find /usr/lib -name libGL.so*
/usr/lib/x86_64-linux-gnu/libGL.so.346.35
/usr/lib/x86_64-linux-gnu/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/libGL.so.1

The /usr/lib/x86_64-linux-gnu/libGL.so.346.35 is the only valid openGL lib on my box (was installed by the Nvidia driver installer).

Solution:

sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.346.35 /usr/lib/x86_64-linux-gnu/libGL.so.1.2.0

Solution 2

It's probably the libgl1-mesa-dev package.

Share:
9,260
theAlse
Author by

theAlse

Updated on September 18, 2022

Comments

  • theAlse
    theAlse almost 2 years

    I have a fresh install of Ubuntu 14 LTS from this morning, I am using a PC with Nvidia graphic cards and I have successfully installed the latest version of the driver from the Nvidia website (NVIDIA-Linux-x86_64-352.30).

    I am trying to build QT 5.4 (qt-everywhere-opensource-src-5.4.2) and I am facing a problem with it not being able to find opengl.

    I have installed the following packages in order to resolve all the dependencies:

    sudo apt-get update
    sudo apt-get install libxi-dev build-essential libdbus-1-dev libfontconfig1-dev     libfreetype6-dev    libx11-dev    libxext-dev     libxfixes-dev    libxi-dev    libxrender-dev    libxcb1-dev    libx11-xcb-dev    libxcb-glx0-dev libxcb-keysyms1-dev    libxcb-image0-dev    libxcb-shm0-dev    libxcb-icccm4-dev    libxcb-sync0-dev    libxcb-xfixes0-dev    libxcb-shape0-dev    libxcb-randr0-dev    libxcb-render-util0-dev
    

    and finally:

    sudo apt-get install mesa-common-dev
    sudo apt-get install libglu1-mesa-dev
    

    As far as I know the above should completely install the opengl packages for Ubuntu.

    I then try to configure QT using the following command:

    ./configure -v -confirm-license -developer-build -opensource -xinput2 -dbus -opengl desktop -nomake examples -nomake tests)
    

    I get the following error:

    OpenGL auto-detection... ()
    g++ -c -pipe -O2 -Wall -W -fPIC  -I. -I../../../mkspecs/linux-g++ -o opengldesktop.o opengldesktop.cpp
    g++ -Wl,-O1 -o opengldesktop opengldesktop.o   -lGL 
    /usr/bin/ld: cannot find -lGL
    collect2: error: ld returned 1 exit status
    make: *** [opengldesktop] Error 1
    OpenGL disabled.
    The OpenGL functionality test failed!
     You might need to modify the include and library search paths by editing
     QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL
    

    I have searched for a while now and I can only assume that I have all the right packages installed but something is missing in the system path. What can be missing and how do I add it to the system path?

    The following output might help:

    ldconfig -p | grep libGL.so
        libGL.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libGL.so.1
        libGL.so.1 (libc6,x86-64) => /usr/lib/libGL.so.1
    
  • Alexander Shishenko
    Alexander Shishenko almost 7 years
    You don't need to unpack it again, gust delete the config.cache file