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...] PROGRAM...

PARAMETERS

-v, --verbose
    Prints all information, including symbol versions, for each required library.

-u, --unused
    Prints unused direct dependencies (for ELF executables). This can help identify libraries that are linked but not actually used by the program.

-r, --reloc-info
    Performs relocations and reports any missing objects or functions from the libraries. This option implies --data-relocs and provides a more comprehensive check.

-d, --data-relocs
    Performs data relocations and reports any missing objects or functions. This is useful for identifying problems with data sections of libraries.

-p, --print-paths
    Prints the directory search paths that ldd (or rather, the dynamic linker) uses to find shared libraries.

--version
    Displays the version information of the ldd utility.

--help
    Shows a help message and exits.

DESCRIPTION

The ldd (list dynamic dependencies) utility is a fundamental tool on Linux and Unix-like systems. It is used to print the shared libraries required by each program or shared library specified on the command line. This command helps users understand which shared objects (.so files) an executable needs to run successfully. It's particularly useful for diagnosing problems where a program fails to start due to missing or incompatible libraries, or for auditing the dependencies of a compiled binary.

Unlike executing the program, ldd works by setting a special environment variable (LD_TRACE_LOADED_OBJECTS) which instructs the dynamic linker (ld.so) to report all library dependencies rather than actually running the program. This allows for a safe inspection of a program's runtime environment, although it carries specific security considerations.

CAVEATS

The command lddd is not a standard Linux command and likely a typo for ldd. The information provided herein pertains to the widely used ldd utility.

A significant caveat when using ldd is its security implications. Because ldd works by setting an environment variable and executing the program, it can be exploited if run on an untrusted or malicious executable. A malicious program could potentially execute arbitrary code as part of its initialization (e.g., through constructor/destructor functions in shared libraries) when ldd attempts to trace its dependencies. Therefore, it is strongly advised not to run ldd on untrusted binaries. Safer alternatives for inspecting dependencies include tools like objdump -p or readelf -d.

HISTORY

The ldd utility is an integral part of the GNU C Library (glibc) on Linux systems and has been a cornerstone for dynamic library management for decades. Its origins are deeply tied to the development of shared libraries and the dynamic linking mechanism in Unix-like operating systems. It provides a user-friendly interface to query the dynamic linker's behavior, allowing developers and system administrators to troubleshoot and understand the runtime environment of executables without the need to debug the dynamic linker directly. Its widespread use reflects the importance of shared libraries in modern software development.

SEE ALSO

objdump(1), readelf(1), ld.so(8), elf(5), dlopen(3)

Copied to clipboard