Under the FHS, system packages (e.g. RPMs) install libraries to /usr/lib (or /usr/lib64).Similarly, libraries compiled using the old configure;make;make install routine, which are not part of the system distribution, by default get installed to /usr/local/lib (or /usr/local/lib64).In general it is considered bad form to require users to alter LD_LIBRARY_PATH or ld.so.conf for applications they install. See for example:http://web.archive.org/web/20060719201954/http://www.visi.com/~barr/ldpath.htmlHowever, shouldn't /usr/local/lib be an exception to this rule?If that's the case why don't many/most distributions include /usr/local/lib on the library search path by default?So far only ArchLinux seems to have considered this to be bugsee http://bugs.archlinux.org/task/20059?project=1&opened=2263 & the related http://bbs.archlinux.org/viewtopic.php?id=99807Is it more correct for an application that needs a library in /usr/local/lib to include /usr/local/lib in its RPATH or to expect the OS to have that setting already? I dislike the idea of using anything not based on $ORIGIN in the RPATH.This is not a question of pedantry as it has implications for system stability and how software should be packaged.
Why isn't /usr/local/lib on the library path by default?
fhs
It has been suggested that /usr/local/lib should be on the default path and it should be considered a 'bug' in Linux variants like Red Hat where it isn't. This answer https://stackoverflow.com/a/17653893points out the salient parts of http://linuxmafia.com/faq/Admin/ld-lib-path.htmlMany Red Hat-derived distributions don't normally include /usr/local/lib in the file /etc/ld.so.conf. I consider this a bug, and adding /usr/local/lib to /etc/ld.so.conf is a common ``fix'' required to run many programs on Red Hat-derived systems.I raised this with Red Hat and I now disagree.Red Hat provided packages are never installed to /usr/local on systems where vendors do install to /usr/local the answer is different. On those systems /usr/local/lib can reasonably be expected to be on the default search path.Red Hat pointed out that /usr/local/lib should not be on the default search path as any library added there could be picked up by RPM and yum. I investigated this further. If you install your own version of a system library in /usr/local/lib then it could satisfy a dependency of another system package you install normally via RPM or yum. Obviously this could affect system stability. Worse it would do so quite subtley. yum check could report that you have all the vendor versions of all the packages you needand not notice you have you own version of something significant in /usr/local/lib.On systems using a different package manager this may not apply.I don't have a complete answer to what to put in your RPATH. However, I think you should avoid depending on libraries in /usr/local/lib and instead have them installed to /opt (i.e. somewhere you control as part of your installation) wherever practical.