List the shared objects that a program requires (Unix)


ldd program ...

Runs on:

QNX Neutrino




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 .interp section, it's called ldqnx.so, and it's in libc, which is why you need to create a symbolic link like this:
[type=link] /usr/lib/ldqnx.so.3=/proc/boot/libc.so

in your mkifs buildfiles.


Run ldd in the directory where the program is located:
$ cd /bin
$ ldd ls
        libc.so4 => /usr/lib/ldqnx-64.so.2 (0x0)
Run ldd using which to resolve the path to the program:
$ ldd `which ksh`
        libc.so.4 => /usr/lib/ldqnx-64.so.2 (0x0)
$ ldd `which ntpdate`
        libsocket.so.3 => /proc/boot/libsocket.so.3 (0x2b5000)
        libm.so.3 => /proc/boot/libm.so.3 (0x4f7000)
        libssl.so.2 => /base/usr/lib/libssl.so.2 (0x72d000)
        libcrypto.so.2 => /proc/boot/libcrypto.so.2 (0x9ae000)
        libc.so.4 => /usr/lib/ldqnx-64.so.2 (0x0)

Environment variables:

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