error while loading shared libraries: : cannot open shared object file: No such file or directory

A fairly typical scenario when installing software that does not come fro the distribution package manager is to install an application and find that it cannot find a library necessary to run, although the library is definitely installed.  I recently ran into this issue when compiling spine on an old Debian Sarge system.

$ ./spine
./spine: error while loading shared libraries: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory

I verified that this file existed with locate.

$ locate libmysqlclient_r.so.15
/usr/local/mysql-5.0.45-linux-i686/lib/libmysqlclient_r.so.15.0.0
/usr/local/mysql-5.0.45-linux-i686/lib/libmysqlclient_r.so.15

The problem was that I did not have the mysql library directory included in /etc/ld.so.conf or /etc/ld.so.conf.d.  To fix the problem, I added the mysql library path to /etc/ld.so.conf and re-ran ldconfig using sudo.

#/etc/ld.so.conf/usr/local/lib/sasl2
/usr/local/lib
/lib
/usr/lib
/usr/lib/atlas
/usr/local/mysql-5.0.45-linux-i686/lib

include /etc/ld.so.conf.d/*.conf

Then run ldconfig:

$ sudo ldconfig

I was then able to run spine without any issues.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *