Difference between revisions of "Ldd"
From Linuxintro
imported>ThorstenStaerk |
imported>ThorstenStaerk |
||
(5 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
;Example | ;Example | ||
+ | <source> | ||
itchy:~ # ldd /usr/local/bin/ktimetracker | itchy:~ # ldd /usr/local/bin/ktimetracker | ||
linux-vdso.so.1 => (0x00007fffdb7ff000) | linux-vdso.so.1 => (0x00007fffdb7ff000) | ||
Line 8: | Line 9: | ||
libkcal.so.4 => /usr/local/lib64/libkcal.so.4 (0x00007feed2dd7000) | libkcal.so.4 => /usr/local/lib64/libkcal.so.4 (0x00007feed2dd7000) | ||
[...] | [...] | ||
+ | </source> | ||
In this case, libkutils is loaded from /usr/local/lib64/libkutils.so.4 to memory address 0x00007feed334b000. | In this case, libkutils is loaded from /usr/local/lib64/libkutils.so.4 to memory address 0x00007feed334b000. | ||
ldd uses the LD_LIBRARY_PATH variable to find out where to search for libraries: | ldd uses the LD_LIBRARY_PATH variable to find out where to search for libraries: | ||
+ | <source> | ||
tweedleburg:~/jail # ldd ktimetracker | tweedleburg:~/jail # ldd ktimetracker | ||
linux-vdso.so.1 => (0x00007fffa7dff000) | linux-vdso.so.1 => (0x00007fffa7dff000) | ||
− | libkutils.so.4 => | + | libkutils.so.4 => /usr/lib64/libkutils.so.4 (0x00007fa69f8e1000) |
libkparts.so.4 => /usr/lib64/libkparts.so.4 (0x00007fa69f69f000) | libkparts.so.4 => /usr/lib64/libkparts.so.4 (0x00007fa69f69f000) | ||
tweedleburg:~/jail # export LD_LIBRARY_PATH=. | tweedleburg:~/jail # export LD_LIBRARY_PATH=. | ||
tweedleburg:~/jail # ldd ktimetracker | tweedleburg:~/jail # ldd ktimetracker | ||
linux-vdso.so.1 => (0x00007fff65fff000) | linux-vdso.so.1 => (0x00007fff65fff000) | ||
− | libkutils.so.4 => | + | libkutils.so.4 => ./libkutils.so.4 (0x00007f595da82000) |
libkparts.so.4 => ./libkparts.so.4 (0x00007f595d831000) | libkparts.so.4 => ./libkparts.so.4 (0x00007f595d831000) | ||
+ | </source> | ||
= Usage = | = Usage = | ||
To find out all files that an executable file depends on: | To find out all files that an executable file depends on: | ||
+ | <source> | ||
ldd /usr/local/bin/ktimetracker | sed "s/^.* => //" | sed "s/ (0x.*//" | ldd /usr/local/bin/ktimetracker | sed "s/^.* => //" | sed "s/ (0x.*//" | ||
+ | </source> | ||
= Saving example = | = Saving example = | ||
− | < | + | <source> |
tweedleburg:~ # ldd /usr/bin/skype | tweedleburg:~ # ldd /usr/bin/skype | ||
linux-gate.so.1 => (0xffffe000) | linux-gate.so.1 => (0xffffe000) | ||
Line 52: | Line 58: | ||
lrwxrwxrwx 1 root root 18 Jun 16 18:41 /usr/lib/libQtDBus.so.4 -> libQtDBus.so.4.5.0 | lrwxrwxrwx 1 root root 18 Jun 16 18:41 /usr/lib/libQtDBus.so.4 -> libQtDBus.so.4.5.0 | ||
tweedleburg:~ # rm /usr/lib/libQtDBus.so.4 | tweedleburg:~ # rm /usr/lib/libQtDBus.so.4 | ||
− | |||
− | |||
tweedleburg:~ # ln -s /usr/lib/libQtDBus.so.4.4.3 /usr/lib/libQtDBus.so.4 | tweedleburg:~ # ln -s /usr/lib/libQtDBus.so.4.4.3 /usr/lib/libQtDBus.so.4 | ||
tweedleburg:~ # ldd /usr/bin/skype | tweedleburg:~ # ldd /usr/bin/skype | ||
Line 85: | Line 89: | ||
libpcre.so.0 => /usr/lib/libpcre.so.0 (0xf78bf000) | libpcre.so.0 => /usr/lib/libpcre.so.0 (0xf78bf000) | ||
tweedleburg:~ # | tweedleburg:~ # | ||
− | </ | + | </source> |
= See also = | = See also = |
Latest revision as of 06:57, 30 March 2020
ldd is a command that shows which libraries are used by an executable file.
- Example
<source>
itchy:~ # ldd /usr/local/bin/ktimetracker linux-vdso.so.1 => (0x00007fffdb7ff000) libkutils.so.4 => /usr/local/lib64/libkutils.so.4 (0x00007feed334b000) libkparts.so.4 => /usr/local/lib64/libkparts.so.4 (0x00007feed30fa000) libkcal.so.4 => /usr/local/lib64/libkcal.so.4 (0x00007feed2dd7000) [...]
</source> In this case, libkutils is loaded from /usr/local/lib64/libkutils.so.4 to memory address 0x00007feed334b000.
ldd uses the LD_LIBRARY_PATH variable to find out where to search for libraries: <source>
tweedleburg:~/jail # ldd ktimetracker linux-vdso.so.1 => (0x00007fffa7dff000) libkutils.so.4 => /usr/lib64/libkutils.so.4 (0x00007fa69f8e1000) libkparts.so.4 => /usr/lib64/libkparts.so.4 (0x00007fa69f69f000) tweedleburg:~/jail # export LD_LIBRARY_PATH=. tweedleburg:~/jail # ldd ktimetracker linux-vdso.so.1 => (0x00007fff65fff000) libkutils.so.4 => ./libkutils.so.4 (0x00007f595da82000) libkparts.so.4 => ./libkparts.so.4 (0x00007f595d831000)
</source>
Usage
To find out all files that an executable file depends on: <source>
ldd /usr/local/bin/ktimetracker | sed "s/^.* => //" | sed "s/ (0x.*//"
</source>
Saving example
<source> tweedleburg:~ # ldd /usr/bin/skype
linux-gate.so.1 => (0xffffe000) libasound.so.2 => /usr/lib/libasound.so.2 (0xf7ea0000) libXv.so.1 => /usr/lib/libXv.so.1 (0xf7e9a000) libXss.so.1 => /usr/lib/libXss.so.1 (0xf7e96000) librt.so.1 => /lib/librt.so.1 (0xf7e8c000) libQtDBus.so.4 => not found libQtGui.so.4 => not found libQtNetwork.so.4 => not found libQtCore.so.4 => not found libpthread.so.0 => /lib/libpthread.so.0 (0xf7e71000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xf7d7c000) libm.so.6 => /lib/libm.so.6 (0xf7d53000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7d44000) libc.so.6 => /lib/libc.so.6 (0xf7be8000) libX11.so.6 => /usr/lib/libX11.so.6 (0xf7ab5000) libXext.so.6 => /usr/lib/libXext.so.6 (0xf7aa4000) libdl.so.2 => /lib/libdl.so.2 (0xf7a9e000) /lib/ld-linux.so.2 (0xf7f99000) libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xf7a9b000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0xf7a7d000) libXau.so.6 => /usr/lib/libXau.so.6 (0xf7a79000)
tweedleburg:~ # ll /usr/lib/libQtDBus.so.4 lrwxrwxrwx 1 root root 18 Jun 16 18:41 /usr/lib/libQtDBus.so.4 -> libQtDBus.so.4.5.0 tweedleburg:~ # rm /usr/lib/libQtDBus.so.4 tweedleburg:~ # ln -s /usr/lib/libQtDBus.so.4.4.3 /usr/lib/libQtDBus.so.4 tweedleburg:~ # ldd /usr/bin/skype
linux-gate.so.1 => (0xffffe000) libasound.so.2 => /usr/lib/libasound.so.2 (0xf7ea6000) libXv.so.1 => /usr/lib/libXv.so.1 (0xf7ea0000) libXss.so.1 => /usr/lib/libXss.so.1 (0xf7e9c000) librt.so.1 => /lib/librt.so.1 (0xf7e92000) libQtDBus.so.4 => /usr/lib/libQtDBus.so.4 (0xf7e28000) libQtGui.so.4 => not found libQtNetwork.so.4 => not found libQtCore.so.4 => not found libpthread.so.0 => /lib/libpthread.so.0 (0xf7e0e000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xf7d19000) libm.so.6 => /lib/libm.so.6 (0xf7cf0000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7ce1000) libc.so.6 => /lib/libc.so.6 (0xf7b85000) libX11.so.6 => /usr/lib/libX11.so.6 (0xf7a52000) libXext.so.6 => /usr/lib/libXext.so.6 (0xf7a41000) libdl.so.2 => /lib/libdl.so.2 (0xf7a3b000) /lib/ld-linux.so.2 (0xf7f9f000) libdbus-1.so.3 => /lib/libdbus-1.so.3 (0xf79f9000) libQtXml.so.4 => not found libQtCore.so.4 => not found libz.so.1 => /lib/libz.so.1 (0xf79e4000) libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xf79dd000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xf7918000) libxcb-xlib.so.0 => /usr/lib/libxcb-xlib.so.0 (0xf7915000) libxcb.so.1 => /usr/lib/libxcb.so.1 (0xf78f7000) libXau.so.6 => /usr/lib/libXau.so.6 (0xf78f3000) libpcre.so.0 => /usr/lib/libpcre.so.0 (0xf78bf000)
tweedleburg:~ # </source>