Where does lb.so look
Hi;
Im a linux newb studying the shared libraries and how they work. I was informed that the /etc/ld.so.conf file contained a list of all the directories that the shared library files are looked for. But when I went to the ld.so man page it said othewise: Contents of the ld.so man page: ======================================================================= 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. o In the default path /lib, and then /usr/lib. If the binary was linked with ‐z nodeflib linker option, this step is skipped. ======================================================================= I am a bit confused, anyone know what actually happens, and why the other is there? Thanks alot to all in advance; movitto |
yes
/lib and /usr/lib are the only directories searched by default however if when the program is compiled with -W1,-rpath,/wherever/wherever then /wherever/wherever is searched also the shell variable LD_LIBRARY_PATH (not used so much anymore) can perform this runtime lib search function LD_LIBRARY_PATH also effects search for linking /etc/ld.so.conf is the search path for linking and doesn't effect runtime /etc/ld.so.cache is the results of running ldconfig against /etc/ld.so.conf there is also an interesting runtime utility alot of people are using now called prelink prelink essentially does more mapping and therefore prevents redundant runtime searches. |
thanks alot foo_bar_foo your explanation really clarified the whole process. I am a bit confused about the whole rpath and LD_Library_path, but Ill leave that to a ltater date. Thanks alot!
|
All times are GMT -5. The time now is 02:16 AM. |