Saturday, January 14, 2012

Problem with libGL.so on 64-bit Ubuntu


I have an Nvidia card and as expected I installed Nvidia drivers for my ubuntu. But, whenever I compiled programs that used OpenGL ( libGL.so ) I ran into compile errors similar to:

No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so'

I was sure there was some problem with my libGL.so file so I ended up looking at it properties and found out that it was a broken link pointing to 'mesa/libGL.so' which in turn was pointing to 'libGL.so.1' which never existed.

bpaluri3@bpaluri3:~/libfreenect/build$ ls -l /usr/lib/x86_64-linux-gnu/libGL.so 
lrwxrwxrwx 1 root root 13 2011-08-10 04:20 /usr/lib/x86_64-linux-gnu/libGL.so -> mesa/libGL.so

bpaluri3@bpaluri3:~/libfreenect/build$ ls -l /usr/lib/x86_64-linux-gnu/mesa/libGL.so 
lrwxrwxrwx 1 root root 10 2011-08-10 04:20 /usr/lib/x86_64-linux-gnu/mesa/libGL.so -> libGL.so.1


Then I verified the libGL.so.1 in my /usr/lib directory and found out that it pointed to libGL.so.290.10 which is the file provided by the nvidia driver.

bpaluri3@bpaluri3:~/libfreenect/build$ ls -l /usr/lib/libGL.so.1 
lrwxrwxrwx 1 root root 15 2012-01-09 13:53 /usr/lib/libGL.so.1 -> libGL.so.290.10

I just overwrote the symbolic link in `/usr/lib/x86_64-linux-gnu/libGL.so' with the nvidia openGL library i.e. `/usr/lib/libGL.so' ( I had to delete the old symbolic link before I do this ).

bpaluri3@bpaluri3:~/libfreenect/build$ sudo rm /usr/lib/x86_64-linux-gnu/libGL.so 
bpaluri3@bpaluri3:~/libfreenect/build$ sudo ln -s /usr/lib/libGL.so.1 /usr/lib/x86_64-linux-gnu/libGL.so 

The final two statements are the fixes for the libGL error and I hope anyone who runs into a similar issue will find this information useful.

30 comments:

Shake said...

Thank you so much. I was running into the same exact error on Linux Mint 12 when trying to build allegro. Again, thanks so much dude, you're the best.

rafay khan said...

Thanks, libGL.so didn't exist in my /usr/lib/x86_64-linux-gnu directory so I just created a symlink for it from the libGL.so that existed in usr/lib and it worked.

capstain said...

It happened to me the very same as rafay khan, and it worked!
Thanks a bunch!

Tomás said...

Awesomeness.

That's what this post was.

Dengue e descaso said...
This comment has been removed by the author.
Eric Christianson said...

B E A U tiful

trentonknight said...

Thank You, that fixed the same issue for me in Debian Wheezy while I was attempting to cmake and then make glfw.

Daniel Grayling said...

I didn't have libGL.so in usr/lib/x86_64-linux-gnu/ but I did have it in usr/lib/x86_64-linux-gnu/mesa so I did

ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so /usr/lib/x86_64-linux-gnu/libGL.so

and everything compiles.

For those of you who have my specific flavour of this problem, because you have an AMD card or something.

Pranay said...

Thankyou for your post. It helped me solve my problem

michele said...

Thank you so much. It saved me!

timHoward said...

Plenty of bang for your buck here. :) Thanks for the post.

Ubu Guru said...

THANK YOU SO MUCH, this helped me solve why I couldn't compile obs-studio.

Coky said...

That worked. Thanks

[hopeful_*] said...

Tks... Helped to clarify.

San said...

Oh you are a genius. Thank you so much!

Pierluigi said...

Thanks! It worked also for me on ubuntu 12.04

enrichicco said...

Similar problem on Debian Jessie (MBP 15), with nvidia proprietary drivers.
I turned the symlink from libGL.so.1.2.0 to:

libGL.so.349.16



and after this I was able to compile virtualGL (well: I still do not know if it works).
Thanks a lot

Gabriel said...

Thanks.

this works fine
:-)

davetcoleman said...

Just had this problem on Ubuntu 14.04, thanks!!

Adam H. said...

Thanks! Worked for me.

Robinson Guevara said...

Gracias, me sirvio en Debian 8 jessie para compilar Dolphin-emu

spooky said...

thank you...I run into the same error

Björn Henriksson said...

thanks!

Unknown said...

Thanks!

Taewan Kim said...

cool stuff
Thanks

Yizhe Chang said...

Thanks, it works!

Nadim Farhat said...

Thanks for your time ! totally worth it !

Nguyen Hong Quan said...

thanks, it works for me

Zhang Wuyang said...

Thanks a lot, it works

Yulun Tian said...

Thank you so much!