LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 06-17-2004, 07:53 PM   #1
movitto
Member
 
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Rep: Reputation: 30
Question 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
 
Old 06-17-2004, 10:01 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
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.

Last edited by foo_bar_foo; 06-17-2004 at 10:02 PM.
 
Old 06-17-2004, 11:54 PM   #3
movitto
Member
 
Registered: May 2004
Distribution: Fedora 4 and Slackware
Posts: 179

Original Poster
Rep: Reputation: 30
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!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration