Use shared libraries in /usr/local/lib

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.


If you've already run ldconfig after building the library, keep reading. If not, read aboout ldconfig first.

/usr/local/lib might not be in the library path that ldconfig uses. You can just do this:

ldconfig /usr/local/lib

And the stuff should be added to the linker cache, but it is probably better to add the path properly. Make sure you have a /etc/ld.so.conf.d directory. If so add a file (call it "usr-local.conf", or whatever), and put one line in it:

/usr/local/lib

Now run ldconfig. If you don't have the ld.so.conf.d directory, you should have a /etc/ld.so.conf file and you can add that line to the end of it.