LinuxCommandLibrary

lddd

List dynamic library dependencies of executables

TLDR

Scan directories to find and list packages with broken library links that need to be rebuilt

$ lddd
copy

SYNOPSIS

ldd [OPTION]... [--] [FILE]...

PARAMETERS

-v, --verbose
    Print all details on shared objects, including symbol versioning and auxiliary info.

-u, --unused
    Print unused direct dependencies.

-d, --data-relocs
    Perform relocations for data objects and report missing ones (runs program briefly).

-r, --function-relocs
    Perform relocations for data and functions, report any missing objects/functions.

--help
    Display usage summary and exit.

--version
    Print version information and exit.

DESCRIPTION

The ldd command displays the dynamic dependencies of executable files or shared libraries, showing which shared objects (libraries) are required at runtime. It is particularly useful for debugging linking issues, verifying library dependencies, and understanding the runtime environment of programs.

Internally, ldd is not a compiled binary but a shell script that sets the environment variable LD_TRACE_LOADED_OBJECTS=1 and invokes the dynamic linker/loader (ld.so or ld-linux.so). This causes the linker to print the libraries it loads instead of executing the program.

For example, running ldd /bin/ls outputs lines like linux-vdso.so.1 => (0x00007fffc39e0000) followed by library paths and memory addresses. It handles both ELF executables and shared objects but reports not a dynamic executable for static binaries.

Options allow verbose output, detection of unused dependencies, or simulation of relocations to check for missing symbols at load time.

CAVEATS

Not suitable for static binaries (prints 'not a dynamic executable'). Options like -d or -r execute the program briefly, posing security risks with untrusted files. Output paths are resolved via ld.so search paths; use LD_LIBRARY_PATH cautiously.

EXAMPLE USAGE

ldd /bin/ls
Outputs dependencies like:
  linux-vdso.so.1 (0x00007fff...)
  libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6

SECURITY NOTE

Avoid ldd on untrusted executables with relocation options, as it may execute code.

HISTORY

Introduced with glibc (GNU C Library) as a wrapper script for the dynamic linker. Evolved alongside ELF format adoption in Linux (1990s); current versions in glibc 2.40+ support modern features like symbol versioning.

SEE ALSO

ld.so(8), readelf(1), objdump(1), nm(1)

Copied to clipboard