Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It is used as a shell variable so that ld (see "man ld") will know what directories to search for shared libraries.
To set it you type:
LD_LIBRARY_PATH=/1stpath/to/libraries:/2ndpath/to/libraries (:...)
Example for Oracle (truncated here) on one of my servers I have:
LD_LIBRARY_PATH=/opt/oracle/product/10.1.0/db_1/lib:/lib:/usr/lib:/opt/oracle/product/10.1.0/db_1/jdk/jre/lib/i386
The above would tell it to first search for a given library in /opt/oracle/product/10.1.0/db_1/lib. If not found there it would
then search in /lib. If not found there it would then search in /usr/lib and so on.
Of course you have to export it like any variable to make it available:
When Linux searches for a library file, it looks at various locations in a certain order. This information is spelled out by man ld.so and, for your convenience, is reproduced here:
Code:
The necessary shared libraries needed by the program are searched for
in the following order:
o Using the DT_RPATH dynamic section attribute of the binary if
present and DT_RUNPATH attribute does not exist.
o Using the environment variable LD_LIBRARY_PATH. Except if the
executable is a setuid/setgid binary, in which case it is
ignored.
o Using the DT_RUNPATH dynamic section attribute of the binary if
present.
o From the cache file /etc/ld.so.cache which contains a compiled
list of candidate libraries previously found in the augmented
library path. If, however, the binary was linked with -z node-
flib linker option, libraries in the default library paths are
skipped. (Note: the ldconfig program builds this cache.)
o In the default path /lib, and then /usr/lib. If the binary was
linked with -z nodeflib linker option, this step is skipped.
Last edited by sundialsvcs; 10-21-2005 at 02:37 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.