2007/05/07

Troubleshooting library issues in Linux

Linux (like Windows) programs can either be linked:
  • statically
    • can create much larger binaries
    • won't get stuck with problems about a library dependency not being met
    • any time an important fix is applied to the library against which it was compiled, you theoretically should rebuild all the binaries you built from it, to make sure they get the fix
  • dynamically (like a windows .dll, but they usually have a .so.* extension)
    • smaller binaries
    • sometimes have library/version dependency problems
    • updating the library has the effect of "fixing" all the binaries that use it dynamically
Generally, most systems prefer dynamically linked programs. However, some tools may require different versions of libraries than come by default on your distro. This can force one to write special wrappers, set up LD_LIBRARY_PATH, and have to troubleshoot annoying problems.

A few of the tools you might use in troubleshooting library problems are:

ldd
ldconfig
objdump

A few environment variables to consider:
LD_LIBRARY_PATH
LD_PRELOAD