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.

34 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.

Unknown 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!

Mr. Wood said...

Awesomeness.

That's what this post was.

Dengue e descaso said...
This comment has been removed by the author.
Unknown 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.

Unknown 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.

Unknown 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 said...

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

spooky said...

thank you...I run into the same error

Unknown said...

Thanks!

Unknown said...

cool stuff
Thanks

Unknown said...

Thanks, it works!

Unknown said...

Thanks for your time ! totally worth it !

Unknown said...

thanks, it works for me

Unknown said...

Thanks a lot, it works

Unknown said...

Thank you so much!

Bronana said...

2019 - and this still works. Linux Mint 19

Unknown said...

Thanks a lot, it worked for me, the difference was that no libGL.so in the usr/lib/ directory, only libGL.so.0.1 was on /usr/lib/x86_64-linux-gnu/ directory so I created the link to libGL.so there.

Ubuntu 18.04

Tara Omar said...

Hiv disease for the last 3 years and had pain hard to eat and cough are nightmares,especially the first year At this stage, the immune system is severely weakened, and the risk of contracting opportunistic infections is much greater. However, not everyone with HIV will go on to develop AIDS. The earlier you receive treatment, the better your outcome will be.I started taking ARV to avoid early death but I had faith in God that i would be healed someday.As a Hiv patent we are advise to be taking antiretroviral treatments to reduce our chance of transmitting the virus to others , few weeks ago i came on search on the internet if i could get any information on Hiv treatment with herbal medicine, on my search i saw a testimony of someone who has been healed from Hiv her name was Achima Abelard and other Herpes Virus patent Tasha Moore also giving testimony about this same man,Called Dr Itua Herbal Center.I was moved by the testimony and i contacted him by his Email.drituaherbalcenter@gmail.com . We chatted and he send me a bottle of herbal medicine I drank it as he instructed me to.After drinking it he ask me to go for a test that how i ended my suffering life of Hiv patent,I'm cured and free of Arv Pills.I'm forever grateful to him Drituaherbalcenter.Here his contact Number +2348149277967...He assure me he can cure the following disease..Hiv,Cancer,Herpes Virus,Hpv,Pile,Weak Erection,Lyme Disease,Epilepsy,Glaucoma.,Brain Tumor,psoriasis, Cataracts,Macular degeneration,Cardiovascular disease,Chronic Diarrhea,Lung disease.Enlarged prostate,Osteoporosis.Alzheimer's disease,
Dementia. ,Bladder Cancer,Autism,Colorectal Cancer,Breast Cancer,Kidney Cancer,Leukemia,Lung Cancer,Tay tach disease,Non Hodgkin Lymphoma,Skin Cancer,Lupus,Uterine Cancer,Prostate Cancer, Seizures, fibromyalgia ,ALS,Hepatitis,Copd,Parkinson disease.Genetic disease,Fibrodysplasia disease,Fibrodysplasia Ossificans Progressiva,Fluoroquinolone Toxicity Syndrome,Stroke,Hpv,Weak Erection,Liver/Kidney Inflammatory,Men/Woman infertility, bowel disease ,Huntington's disease ,Diabetes,Fibroid.

Checker1 said...
This comment has been removed by the author.
Checker1 said...

The comment from "Tara Omar" (up mine) is a scam, take care