ldd: command not found

The ldd(1) (list dynamic dependencies) command displays the shared libraries that a program (or a shared library) requires to run. Here’s an example:

$ ldd prog
         libdemo.so.1 => /usr/lib/libdemo.so.1 (0x40019000)
         libc.so.6 => /lib/tls/libc.so.6 (0x4017b000)
         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

The ldd command enables a user to view shared library dependencies for an application. This can be useful for troubleshooting or gathering information about system requirements for an application.

Syntax

The syntax of the ldd command is:

# ldd [options] {program binary}

If you encounter the below error while running the ldd command:

ldd: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install libc-bin
Ubuntu apt-get install libc-bin
Arch Linux pacman -S glibc
Kali Linux apt-get install libc-bin
CentOS yum install glibc-common
Fedora dnf install glibc-common
Raspbian apt-get install libc-bin

The ldd command resolves each library reference (employing the same search conventions as the dynamic linker) and displays the results in the following form:

library-name => resolves-to-path

ldd Command Examples

1. Display shared library dependencies of a binary:

# ldd path/to/binary

2. Display all information about dependencies:

# ldd --verbose path/to/binary

3. Display unused direct dependencies:

# ldd --unused path/to/binary

4. Report missing data objects and perform data relocations:

# ldd --data-relocs path/to/binary

5. Report missing data objects and functions, and perform relocations for both:

# ldd --function-relocs path/to/binary
Related Post