The dynamic loader finds shared libraries thanks to two files --
/etc/ld.so.conf and /etc/ld.so.cache. If you
cat your /etc/ld.so.conf file, you'll probably see a
listing that looks something like this:
$ cat /etc/ld.so.conf
/usr/X11R6/lib
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3
/usr/lib/mozilla
/usr/lib/qt-x11-2.3.1/lib
/usr/local/lib
The ld.so.conf file contains a listing of all directories
(besides /lib and /usr/lib, which are automatically
included) in which the dynamic loader will look for shared libraries.