Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error while loading shared libraries libpng16

Tags:

I am trying to compile and run this code under ubuntu 14.04. I downloaded and installed libpng version 1.6.12. I am able to compile the code using gcc test.c -lpng but when I try to run it, I get this error: ./a.out: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

edit:
So I found libpng16.so.16, it was in /usr/local/lib and I copied it to /usr/local/include/libpng16/ and as well to /usr/local/include/ and recompiled the code, anyway the problem still persists.

Any suggestions ?

like image 292
Michal Krakovsky Avatar asked Aug 28 '14 13:08

Michal Krakovsky


2 Answers

Ok so I found the solution here. The trick is to run sudo ldconfig after you install some shared library.

like image 84
Michal Krakovsky Avatar answered Sep 21 '22 21:09

Michal Krakovsky


You can download the library from the link https://sourceforge.net/projects/libpng/?source=directory

It will download a file something like "libpng-1.6.32.tar.xz"

Simply extract the file go inside folder and run these commands to install

./configure make check make install 

Then you need to run after installing any library

ldconfig 
like image 31
Krishan Kumar Mourya Avatar answered Sep 21 '22 21:09

Krishan Kumar Mourya