Example 3 Using the ldd command
•By default, ldd prints simple dynamic path information, including the dependencies recorded in the executable (or the shared library) followed by the physical location where the dynamic loader finds these libraries.
$ ldd a.out
./libx.so => ./libx.so
libc.so.1 => /usr/lib/hpux32/libc.so.1
libdl.so.1 => | /usr/lib/hpux32/libdl.so.1 |
•The
$ ldd
find library=./libx.so; required by a.out
| ./libx.so | => | ./libx.so | |
find | library=libc.so.1; required by a.out | |||
| libc.so.1 | => | /usr/lib/hpux32/libc.so.1 | |
find | library=libdl.so.1; required by usr/lib/hpux32/libc.so.1 | |||
| libdl.so.1 => | /usr/lib/hpux32/libdl.so.1 |
•The
$ldd
./libx.sl | => | ./libx.sl |
libc.so.1 | => | /usr/lib/hpux32/libc.so.1 |
libdl.1 => | /usr/lib/hpux32/libdl.so.1 |
symbol not | found: val1 (./libx.so) | ||
symbol not | found: count (./libx.so) | ||
symbol | not | found: func1 | (./libx.so) |
symbol | not | found: func2 | (./libx.so) |
•The
$ ldd
libx.so | => |
| ./libx.so | |
libc.so.1 => | /usr/lib/hpux32/libc.so.1 | |||
libdl.so.1 | => | /usr/lib/hpux32/libdl.so.1 | ||
bar (data) | : needed by | a.out; found in ./libx.so | ||
bar (data) | : needed by | ./libx.so; found in ./libx.so | ||
$ ldd |
|
|
| |
libx.so | => |
| ./libx.so | |
libc.so.1 => | /usr/lib/hpux32/libc.so.1 | |||
libdl.so.1 | => | /usr/lib/hpux32/libdl.so.1 | ||
foo (code) | : needed | by a.out; found in ./libx.so | ||
foo (code) | : needed | by ./libx.so; found in ./libx.so | ||
|
|
|
|
|
Listing Dynamic Libraries with pldd(1)
Given a process ID (PID) or a corefile, the pldd command prints a list of shared libraries loaded including those loaded explicitly with dlopen() and shl_load(). The pldd command works by attaching to the process to read its memory. Mismatch between executable and corefile may result in unpredictable behavior. The pldd command searches for the executable file in the current
Listing Dynamic Libraries with pldd(1) 61