The LD_DEBUG environment variable (2012)
3 hours ago
- #debugging
- #ld_debug
- #linux
- The LD_DEBUG environment variable is a powerful Linux tool for debugging shared library loading issues.
- By setting LD_DEBUG to options like 'libs', 'reloc', or 'all', the dynamic linker provides detailed debug output.
- The output can be redirected to a file using LD_DEBUG_OUTPUT for easier analysis.
- Other useful tools for linking issues include strace, ldd, objdump, patchelf, and LD_PRELOAD.
- While primarily for Linux, similar debugging features on Windows can be enabled via 'Show Loader Snaps' with gflags and WinDbg.
- LD_DEBUG helps resolve common bugs from loading incorrect library versions in complex systems.