Ubuntu – Use shared libraries in /usr/local/lib

librariesUbuntu

I have build some libraries from sources, and the files after make install are in /usr/local/lib

For example, in my case I have the file libodb-2.2.so which is in this directory.

However when I launch the executable that has linked with libodb, I got the error: error while loading shared libraries: libodb-2.2.so: cannont open shared object file: No such file or directory.

Does it mean that I have build my executable not correctly ? or should I indicate the system that there may be some interesting libs in the folder /usr/local/lib also ?

I'm using Ubuntu 12.04, Linux kernel 3.2.0-38-generic.

Best Answer

For the current session you can

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

or to make the change permanent you can add /usr/local/lib to /etc/ld.so.conf (or something it includes) and run ldconfig as root.

If you're still having problems, running ldd [executable name] will show you the libraries it's trying to find, and which ones can't be found.

Related Question