Linux Binaries and Libraries

To find our which libraries a linux binary uses, run the ldd command against it.

      ldd /usr/bin/top
      linux-vdso.so.1 =>  (0x00007fffc6eaf000)
      libproc-3.2.8.so => /lib64/libproc-3.2.8.so (0x0000003a58000000)
      libncursesw.so.5 => /lib64/libncursesw.so.5 (0x0000003a5b000000)
      libc.so.6 => /lib64/libc.so.6 (0x0000003a57c00000)
      libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003a59c00000)
      libdl.so.2 => /lib64/libdl.so.2 (0x0000003a57800000)
      /lib64/ld-linux-x86-64.so.2 (0x0000003a57400000)

If you get a “file not found” message, the binary can't find the libabry it requires. Assuming it has been installed, the path can be added to the LD_LIBRARY_PATH variable.

To find out which libraries are known, use ldconfig -p to list them

      ldconfig -p | more
      730 libs found in cache `/etc/ld.so.cache'
      libz.so.1 (libc6,x86-64) => /lib64/libz.so.1
      libz.so.1 (libc6) => /lib/libz.so.1
      libxul.so (libc6,x86-64) => /usr/lib64/xulrunner/libxul.so
      libxtables.so.4 (libc6,x86-64) => /lib64/libxtables.so.4
      libxslt.so.1 (libc6,x86-64) => /usr/lib64/libxslt.so.1
      libxpcom.so (libc6,x86-64) => /usr/lib64/xulrunner/libxpcom.so
      libxml2.so.2 (libc6,x86-64) => /usr/lib64/libxml2.so.2
      libxmlrpc_util.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc_util.so.3
      libxmlrpc_server_cgi.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc_server_cgi.so.3
      libxmlrpc_server_abyss.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc_server_abyss.so.3
      libxmlrpc_server.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc_server.so.3
      libxmlrpc_client.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc_client.so.3
      libxmlrpc_abyss.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc_abyss.so.3
      libxmlrpc.so.3 (libc6,x86-64) => /usr/lib64/libxmlrpc.so.3
      libxkbfile.so.1 (libc6,x86-64) => /usr/lib64/libxkbfile.so.1

As the command indicates, these are the libraries that have been cached. Additional (non default) locations can be added by configuring file /etc/ld.so.conf or adding configuration files to /etc/ld.so.conf.d . After this ldconfig (with no arguments) must be run to refresh the cache.

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password