114 Chapter 4
Linker Tools
Viewing library dependencies with ldd(1)
$ldd a.out
./libx.sl =>./libx.sl
libc.2 =>/lib/pa20_64/libc.2
libdl.1 =>/lib/pa20_64/libdl.1
• The -v option causes ldd to print dependency relationship along with
the dynamic path information.
$ldd -v a.out
find library=./libx.sl; required by a.out
./libx.sl =>./libx.sl
find library=libc.2; required by a.out
libc.2 =>/lib/pa20_64/libc.2
find library=libdl.1; required by /lib/pa20_64/libc.2
libdl.1 =>/lib/pa20_64/libdl.1
• The -r option to causes it to analyze all symbol references and print
information about unsatisfied code and data symbols.
$ldd -r a.out
./libx.sl=>./libx.sl
libc.2=>/lib/pa20_64/libc.2
libdl.1=>/lib/pa20_64/libdl.1
symbol not found: val1 (./libx.sl)
symbol not found: count (./libx.sl)
symbol not found: func1 (./libx.sl)
symbol not found: func2 (./libx.sl)