查找应用编译时所找的动态库:LD_DEBUG
LD_DEBUG 是 glibc 中的 loader 为了方便自身调试而设置的一个环境变量。
命令 :LD_DEBUG=help ls,显示帮助信息,例:
Valid options for the LD_DEBUG environment variable are:
libs display library search paths
reloc display relocation processing
files display progress for input file
symbols display symbol table processing
bindings display information about symbol binding
versions display version dependencies
all all previous options combined
statistics display relocation statistics
unused determined unused DSOs
help display this help message and exit
命令 :LD_DEBUG=libs ./batMain,显示batMain程序锁关联的动态库。例:
14943: find library=libBase.so [0]; searching
14943: search path=tls/i686/sse2:tls/i686:tls/sse2:tls:i686/sse2:i686:sse2::/oracle/product/10.2.0/lib/tls/i686/sse2:/oracle/product/10.2.0/lib/tls/i686:/oracle/product/10.2.0/lib/tls/sse2:/oracle/product/10.2.0/lib/tls:/oracle/product/10.2.0/lib/i686/sse2:/oracle/product/10.2.0/lib/i686:/oracle/product/10.2.0/lib/sse2:/oracle/product/10.2.0/lib:/home/lcc/lib/tls/i686/sse2:/home/lcc/lib/tls/i686:/home/lcc/lib/tls/sse2:/home/lcc/lib/tls:/home/lcc/lib/i686/sse2:/home/lcc/lib/i686:/home/lcc/lib/sse2:/home/lcc/lib (LD_LIBRARY_PATH)
14943: trying file=tls/i686/sse2/libBase.so
14943: trying file=tls/i686/libBase.so
14943: trying file=tls/sse2/libBase.so
14943: trying file=tls/libBase.so
14943: trying file=i686/sse2/libBase.so
14943: trying file=i686/libBase.so
14943: trying file=sse2/libBase.so
14943: trying file=libBase.so
14943: trying file=/oracle/product/10.2.0/lib/tls/i686/sse2/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/tls/i686/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/tls/sse2/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/tls/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/i686/sse2/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/i686/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/sse2/libBase.so
14943: trying file=/oracle/product/10.2.0/lib/libBase.so
14943: trying file=/home/lcc/lib/tls/i686/sse2/libBase.so
14943: trying file=/home/lcc/lib/tls/i686/libBase.so
14943: trying file=/home/lcc/lib/tls/sse2/libBase.so
14943: trying file=/home/lcc/lib/tls/libBase.so