Cannot find -lGL

Bug #1770742 reported by DeathByDenim
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libglvnd (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I was trying to compile a OpenGL program, but it fails to compile. I suppose the package this bug is in is really libglvnd-dev, but I could not find that in Launchpad.

Anyway, the linking error is:
/usr/bin/x86_64-linux-gnu-ld: cannot find -lGL
collect2: error: ld returned 1 exit status

This seems to be because the symlink libGL.so is missing. If I go to /usr/lib/x86_64-linux-gnu and type:
  sudo ln -s libGL.so.1 libGL.so
then compiling works.

Here is a (nonsensical) test program:
#include <GL/gl.h>

int main(int argc, char *argv[])
{
        glEnable(GL_DEPTH_TEST);

        return 0;
}

which I compile with:
  gcc testgl.c -lGL

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: libgl1 1.0.0-2ubuntu2
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: KDE
Date: Fri May 11 15:48:17 2018
EcryptfsInUse: Yes
InstallationDate: Installed on 2018-04-29 (12 days ago)
InstallationMedia: Kubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: libglvnd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
DeathByDenim (silvercanarie-2) wrote :
Revision history for this message
Scott Talbert (swt-techie) wrote :

Do you have the proprietary nvidia driver installed by chance?

Revision history for this message
N. Miller (urklang) wrote :

I just ran into the same bug and can confirm that the workaround works. I do happen to be running the proprietary Nvidia driver.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

you should just install libglvnd-dev which ships the link

Changed in libglvnd (Ubuntu):
status: New → Invalid
Revision history for this message
Scott Talbert (swt-techie) wrote :

@Timo - it isn't completely clear, but it sounds like the original reporter had libglvnd-dev installed. My suspicion on this is that the proprietary driver wiped out the link somehow, but I couldn't reproduce that when I tried.

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

nothing would suggest that from what I can see.. and the nvidia driver in the archive should work fine with glvnd, so unless the driver is from a 3rd party (which we don't support) things should be ok

Revision history for this message
DeathByDenim (silvercanarie-2) wrote :

Oh, sorry. I'm really late to reply to this. Yeah, I do have the proprietary nVidia drivers installed. Those drivers came from the default Ubuntu repositories.

Revision history for this message
Dan Kegel (dank) wrote :

This just hit me as well, on a kosher 18.04 system.

I recently upgraded to a newer nvidia card, so that must have mangled it somehow.

Looks like three of its symlinks got nuked:

ls: cannot access '/usr/lib/x86_64-linux-gnu/libEGL.so': No such file or directory
ls: cannot access '/usr/lib/x86_64-linux-gnu/libGL.so': No such file or directory
ls: cannot access '/usr/lib/x86_64-linux-gnu/libGLESv2.so': No such file or directory
lrwxrwxrwx 1 root root 22 Jun 5 07:16 /usr/lib/x86_64-linux-gnu/libGLdispatch.so -> libGLdispatch.so.0.0.0
...
-rw-r--r-- 1 root root 4697 Jan 25 2018 /usr/share/doc/libglvnd-dev/copyright

Doing

sudo apt install --reinstall libglvnd-dev

resolved the problem here.

Revision history for this message
efa (efa) wrote :

hit the trouble today. No proprietary Nvidia driver in use, only X.Org Nouveau

I had package 'libglvnd-dev' installed, but still miss the files/link:
/usr/lib/x86_64-linux-gnu/libEGL.so
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so
/usr/lib/x86_64-linux-gnu/libGLESv2.so
while are present the other present in the package:
/usr/lib/x86_64-linux-gnu/libGLX.so
/usr/lib/x86_64-linux-gnu/libGLdispatch.so
/usr/lib/x86_64-linux-gnu/libOpenGL.so

sudo apt install --reinstall libglvnd-dev
do not solved the trouble

Revision history for this message
efa (efa) wrote :

worked:
/usr/lib/x86_64-linux-gnu$ sudo ln -s libGL.so.1.0.0 libGL.so

Revision history for this message
efa (efa) wrote :

/usr/lib/x86_64-linux-gnu$ sudo ln -s libEGL.so.1.0.0 libEGL.so
/usr/lib/x86_64-linux-gnu$ sudo ln -s libGLESv1_CM.so.1.0.0 libGLESv1_CM.so
/usr/lib/x86_64-linux-gnu$ sudo ln -s libGLESv2.so.2.0.0 libGLESv2.so

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.