error while loading shared libraries libpng16 - c

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 ?

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

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

I had same problem before I had installed it form below link and problem fixed.
I hope yours would be fixed as well
PNG reference library: libpng

Related

arm-none-eabi-gdb: " error while loading shared libraries: libncurses.so.5" - Fedora

The arm-none-eabi-* packages for Fedora 36 do not provide arm-none-eabi-gdb. So I downloaded the pre-compiled binaries for Linux directly from Arm. When I try to run arm-none-eabi-gdb, I get the following error message.
$ ./arm-none-eabi-gdb
./arm-none-eabi-gdb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
Based on this answer to this related question, the solution is to install the ncurses-compat-libs package.
$ sudo dnf install ncurses-compat-libs
There are other solutions out there in the wild that suggest doing something like creating symbolic links to the newer .so files, but I think installing the compatibility library is the preferred approach.

h5dump fails with "libhdf5_serial.so.100: cannot open shared object file"

I am on Ubunto 18.04. I installed libhdf5-serial-dev:
sudo apt-get install libhdf5-serial-dev
This installed ok - no errors. I can compile, link, and run a C++ file ok that creates and populates an HDF5 file. The resultant file looks good - I can read it ok with h5py and Python.
I installed hdf5-tools:
sudo apt-get install hdf5-tools
That also installed ok - no errors. But when I run h5dump I get:
h5dump: error while loading shared libraries: libhdf5_serial.so.100: cannot open shared object file: No such file or directory
That file does not exist in /usr/lib/x86_64-linux-gnu/hdf5/serial (or /usr/lib/x86_64-linux-gnu). No files with ".100" exist in either of those directories.
Any suggestions on what I've done wrong, and/or how to fix this?
None of the answers I found on the web helped me solve this problem - I tried every suggestion I found.
In the end, updating to Ubuntu 20.04 fixed the problem. Maybe reinstalling Ubuntu 18.04 would also have fixed the problem.

Sleuthkit -- Error while loading shared libraries

After successfully building and compiling sleuthkit library [4.2 version], I tried to write an introspection tool using the library.. Thing is whenever i am trying to compile the program in order to test it and I am using a function from the library API I'm get the following error :
error while loading shared libraries: libtsk.so.13: cannot open shared object file: No such file or directory
I found thought that this file exists in /usr/local/lib folder . Am i missing something ? ./configure && make didn't give me any errors.. and I am including -ltsk on the makefile!
My pc information : XEN hypervisor [Ubuntu 12.04 x64bit] and i am trying to investigate a guest vm running ubuntu 12.04 x32bit
Thanks in advance
I found a solution to the problem , if I install -dev package...
sudo apt-get install libtsk-dev
Also read this useful article... Understood why exactly that happened .

How do I statically link to a lib when creating a command line program in xcode?

I'm new to OSX and XCode and I'm trying to statically link to a C app. I downloaded and installed libconfig and I link to the installed libconfig.a. It works great on my machine but when I run my binary on another machine I get an error that says libconfig.dylib can't be found. Naturally, I don't want to have to install libconfig everywhere I use my app.
I've scoured through the xcode build settings and the only reference I see is the one for libconfig.a. What am I doing wrong?
I got this to work. This seems to be a libconfig build issue, maybe expected behavior but it surprised me. I was linking to libconfig.a, but it appears that libconfig.a was linking to libconfig.dylib. I reconfigure libconfig and reinstalled it.
./configure --disable-shared
make clean
make
make install

How to build example with shared object in GnuTLS

I'm trying to compile example from GnuTLS. I can compile GnuTLS with no problem.
I usually use this command when I have default GnuTLS package installed. I compile the example with this commend.
gcc -o server ex-serv-srp.c -lgnutls
I build GnuTLS from source. I can compile the example with the same command but when I try to run the example I get this error:
./server: error while loading shared libraries: libgnutls.so.28: cannot open shared object file: No such file or directory
The location of libgnutls.so.28 is in /usr/local/lib directory. How I can link the example during compilation time so that they will know where to find libgnutls.so.28
Regards
For a permanent solution add /usr/local/lib to /etc/ld.so.conf and rerun ldconfig, otherwise do as zvbra proposes.
You should set LD_LIBRARY_PATH variable like this export LD_LIBRARY_PATH=/usr/local/lib.

Resources