Next: , Previous: , Up: Tips and Tricks   [Contents][Index]


7.5 Implicit dynamic-library search paths

By default, coNCePTuaL installs both a static and dynamic library with the dynamic library taking precedence (at least on most Unix and Unix-like operating systems). While dynamic libraries offer a number of benefits—such as not requiring applications to be relinked every time a library is upgraded—one inconvenience is the need to set the LD_LIBRARY_PATH environment variable to point to the coNCePTuaL library directory if the coNCePTuaL run-time library is not installed in a standard location (e.g., /usr/lib).

An alternative to setting LD_LIBRARY_PATH is to specify the target library directory at configuration time via the LDFLAGS variable and let the linker embed that directory into the coNCePTuaL run-time library’s dynamic search path. Many linkers accept a -rpath option for exactly that purpose. With the GNU C compiler and linker the appropriate option is LDFLAGS="-Wl,-rpath,directory" (e.g., ‘LDFLAGS="-Wl,-rpath,/usr/local/ncptl/lib"’). Other compilers may have analogous mechanisms for passing flags directly to the linker.

Scott Pakin, pakin@lanl.gov