The dynamic linker and the runtime linker determine their search paths through a different algorithm from that used by the SunOS release 4.x linker.
The examples below compare the search paths for the dynamic linker and the runtime linker for SunOS release 4.x and the Solaris 7 operating environment. Notice that in the latter, the search path for the link editor and the runtime linker are affected by the LD_LIBRARY_PATH
setting. However, the runtime linker permits programs to find shared libraries without having to set LD_LIBRARY_PATH
and makes the loading of shared libraries even more efficient. Consequently, with Solaris 7, Sun recommends that you use $ORIGIN instead, since you must build your program with a built-in library path relative to where prog is installed. For example .../package/bin/prog uses .../package/lib/libmine.so.1.
SunOS release 4.x linker search paths:
Link Editor: -L, LD_LIBRARY_PATH
, /usr/lib, /usr/local/lib
Runtime Linker: LD_LIBRARY_PATH
, -L, /usr/lib, /usr/local/lib
Solaris 7 linker search paths (with LD_LIBRARY_PATH
=dirlist1):
Link Editor: -L, dirlist1, /usr/ccs/lib, /usr/lib
Runtime Linker: dirlist1, -R, /usr/lib
Solaris 7 linker search paths (with LD_LIBRARY_PATH
=dirlist1,dirlist2):
Link Editor: dirlist1, -L, dirlist2, /usr/ccs/lib, /usr/lib
Solaris 7 linker search paths using $ORIGIN
Runtime Linker: -R, $ORIGIN/../lib
Also, with Solaris 7, LD_LIBRARY_PATH_64
is a 64-bit only version of LD_LIBRARY_PATH
.