Cannot find -lGL

Bug #1770742 reported by DeathByDenim on 2018-05-11
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libglvnd (Ubuntu)

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 is missing. If I go to /usr/lib/x86_64-linux-gnu and type:
  sudo ln -s
then compiling works.

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

int main(int argc, char *argv[])

        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)

DeathByDenim (silvercanarie-2) wrote :
Scott Talbert (swt-techie) wrote :

Do you have the proprietary nvidia driver installed by chance?

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.

Timo Aaltonen (tjaalton) wrote :

you should just install libglvnd-dev which ships the link

Changed in libglvnd (Ubuntu):
status: New → Invalid
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.

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

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.

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/': No such file or directory
ls: cannot access '/usr/lib/x86_64-linux-gnu/': No such file or directory
ls: cannot access '/usr/lib/x86_64-linux-gnu/': No such file or directory
lrwxrwxrwx 1 root root 22 Jun 5 07:16 /usr/lib/x86_64-linux-gnu/ ->
-rw-r--r-- 1 root root 4697 Jan 25 2018 /usr/share/doc/libglvnd-dev/copyright


sudo apt install --reinstall libglvnd-dev

resolved the problem here.

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

Other bug subscribers