LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how does ldd command knows about depending shared objects (https://www.linuxquestions.org/questions/linux-newbie-8/how-does-ldd-command-knows-about-depending-shared-objects-838975/)

divyavyas 10-19-2010 01:44 AM

how does ldd command knows about depending shared objects
 
hi,

I would like to know how ldd command detects the depending shared object .
I have gone through /bin/ldd script but did not got anything.

I am new to linux .Please give me some idea.

kbp 10-19-2010 04:47 AM

It probably reads the import table of the binary .. you may want to look at doco on the ELF file format

cheers

Valery Reznic 10-20-2010 09:00 AM

Quote:

Originally Posted by kbp (Post 4132271)
It probably reads the import table of the binary .. you may want to look at doco on the ELF file format

cheers

No, ldd (on Linux) run executable in question with environment variable LD_TRACE_LOADED_OBJECTS set, and it tell to ld-linux not actually run the program, but only dump it's dependencies.

ldd is actually a script, so you can have a look yourself

wikapuki 10-20-2010 09:37 AM

Hi,

I am sure you meant as your posting read, but just incase you meant show me an example of how it works:

I use it to find out what library's are no longer installed after an update on my AMD64 which are needed for skype bit binary. SO I do the following:
ldd /usr/bin/skype | grep 'not found'

or without the filter:

ldd /usr/bin/skype
linux-gate.so.1 => (0xf77d7000)
libasound.so.2 => /usr/lib32/libasound.so.2 (0xf76ea000)
libXv.so.1 => /usr/lib32/libXv.so.1 (0xf76e5000)
libXss.so.1 => /usr/lib32/libXss.so.1 (0xf76e1000)
libSM.so.6 => /usr/lib32/libSM.so.6 (0xf76d9000)
libICE.so.6 => /usr/lib32/libICE.so.6 (0xf76c1000)
libXi.so.6 => /usr/lib32/libXi.so.6 (0xf76b4000)
libXrender.so.1 => /usr/lib32/libXrender.so.1 (0xf76ab000)
libXrandr.so.2 => /usr/lib32/libXrandr.so.2 (0xf76a4000)
libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0xf762c000)
libfontconfig.so.1 => /usr/lib32/libfontconfig.so.1 (0xf75fd000)
libXext.so.6 => /usr/lib32/libXext.so.6 (0xf75ee000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf74d1000)
libz.so.1 => /usr/lib32/libz.so.1 (0xf74bc000)
libgthread-2.0.so.0 => /usr/lib32/libgthread-2.0.so.0 (0xf74b6000)
libglib-2.0.so.0 => /lib32/libglib-2.0.so.0 (0xf73ed000)
librt.so.1 => /lib32/librt.so.1 (0xf73e4000)
libdl.so.2 => /lib32/libdl.so.2 (0xf73e0000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf73c7000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf72d2000)
libm.so.6 => /lib32/libm.so.6 (0xf72ab000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf728d000)
libc.so.6 => /lib32/libc.so.6 (0xf7146000)
libuuid.so.1 => /lib32/libuuid.so.1 (0xf7142000)
libexpat.so.1 => /usr/lib32/libexpat.so.1 (0xf711c000)
libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf7102000)
libpcre.so.3 => /lib32/libpcre.so.3 (0xf70cf000)
/lib/ld-linux.so.2 (0xf77d8000)
libXau.so.6 => /usr/lib32/libXau.so.6 (0xf70cc000)
libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf70c7000)

divyavyas 10-20-2010 11:11 PM

thanks............but my doubt is still there .........not able to visualize


All times are GMT -5. The time now is 04:03 PM.