ldd

Updated: April 19, 2023

List the shared objects that a program requires (Unix)

Syntax:

ldd program ...

Runs on:

QNX Neutrino

Options:

None.

Description:

The ldd (“list dynamic dependencies”) command lists the shared objects that the specified programs require. If you don't specify the full path for a program, ldd looks for it in your current directory.

You can use this utility to determine which shared objects to include in an OS image; see the OS Image Buildfiles chapter of Building Embedded Systems.

Note: It's worth noting that ldd is also the name of the runtime linker. In the ELF .interp section, it's called /usr/lib/ldqnx.so for 32-bit targets, and /usr/lib/ldqnx-64.so for 64-bit targets.

Examples:

Run ldd in the directory where the program is located:
$ cd /bin
$ ldd ls
./ls:
        libc.so.5 => /proc/boot/libc.so.5 (0x19dbd08000)
Run ldd using which to resolve the path to the program:
$ ldd `which ksh`
/proc/boot/ksh:
        libc.so.5 => /proc/boot/libc.so.5 (0xb65a48000)
$ ldd `which ntpdate`
/base/usr/sbin/ntpdate:
        libsocket.so.3 => /proc/boot/libsocket.so.3 (0x38c468000)
        libm.so.3 => /proc/boot/libm.so.3 (0x38c6aa000)
        libcrypto.so.2.1 => /proc/boot/libcrypto.so.2.1 (0x38c8e0000)
        libintl.so.1 => /usr/lib/libintl.so.1 (0x38ce26000)
        libc.so.5 => /proc/boot/libc.so.5 (0x38d036000)
        libiconv.so.1 => /usr/lib/libiconv.so.1 (0x38d2f0000)

Environment variables:

DL_DEBUG
If this environment variable is set, the shared library loader displays debugging information about the libraries as they're opened.