>How does linux (or maybe bash?) know which directories to look in for
>library files when it loads up a program? On other systems it seems to be
>done by setting the LD_LIBRARY_PATH enviroment variable but in linux this
>has no effect. Surely I don't have to place new libraries in either /lib
>or /usr/lib because these are the only ones it looks in and this can't be
>changed?
You can change the default locations where the loader looks for
shared libraries by editing /etc/ld.so.conf and then running
ldconfig. This is a system wide setting and will affect all
users. Alternatively the LD_LIBRARY_PATH environment variable
should work in the way you expected it to, though there
are a couple of points to note. LD_LIBRARY_PATH is ignored
for programs which are setuid or setgid. If your program
is in aout format then the relevant environment variable
is LD_AOUT_LIBRARY_PATH. Check the man page for ld.so
(the dynamic linker) for details.
Norman