View dynamic library dependencies with ldd


The ldd command allows you to view detailed information about library dependencies of dynamically linked programs and other shared libraries. ldd uses the runtime linker which reads the ELF formatted executable to generate the output. It is a helpful tool to have at your disposal when debugging broken programs.

Here ldd examines the ‘ls’ executable. The output displays the dependencies as well as how they will be resolved if run with the current environment.

Sometimes you will see that an application can’t resolve one or more libraries. It would most likely fail to execute at this moment if you see a “not found” entry like this.

To resolve these type of issues you can either install the missing libraries, or if they are already installed, update the LD_LIBRARY_PATH environment variable with the path to the libraries.

Once you have done one of these two things, rerun ldd on the executable and verify that the library dependency can now be correctly resolved.

One last caveat, ldd will not display information about shared libraries that the program may try to open using the glibc function dl_open() during its execution.