root@ubuntu:/usr/local/bin# ldd memcached
linux-vdso.so.1 => (0x00007ffff4ffc000)
libevent-1.4.so.2 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3b0579c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3b053d6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3b059c2000)
使用LD_DEBUG查看:
root@ubuntu:/usr/local/lib# LD_DEBUG=libs /usr/local/bin/memcached -v
12842: find library=libevent-1.4.so.2 [0]; searching
12842: search cache=/etc/ld.so.cache
12842: search path=/lib/x86_64-linux-gnu/tls/x86_64:/lib/x86_64-linux-gnu/tls:/lib/x86_64-linux-gnu/x86_64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/tls/x86_64:/usr/lib/x86_64-linux-gnu/tls:/usr/lib/x86_64-linux-gnu/x86_64:/usr/lib/x86_64-linux-gnu:/lib/tls/x86_64:/lib/tls:/lib/x86_64:/lib:/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/x86_64:/usr/lib(system search path)
12842: trying file=/lib/x86_64-linux-gnu/tls/x86_64/libevent-1.4.so.2
12842: trying file=/lib/x86_64-linux-gnu/tls/libevent-1.4.so.2
12842: trying file=/lib/x86_64-linux-gnu/x86_64/libevent-1.4.so.2
12842: trying file=/lib/x86_64-linux-gnu/libevent-1.4.so.2
12842: trying file=/usr/lib/x86_64-linux-gnu/tls/x86_64/libevent-1.4.so.2
12842: trying file=/usr/lib/x86_64-linux-gnu/tls/libevent-1.4.so.2
12842: trying file=/usr/lib/x86_64-linux-gnu/x86_64/libevent-1.4.so.2
12842: trying file=/usr/lib/x86_64-linux-gnu/libevent-1.4.so.2
12842: trying file=/lib/tls/x86_64/libevent-1.4.so.2
12842: trying file=/lib/tls/libevent-1.4.so.2
12842: trying file=/lib/x86_64/libevent-1.4.so.2
12842: trying file=/lib/libevent-1.4.so.2
12842: trying file=/usr/lib/tls/x86_64/libevent-1.4.so.2
12842: trying file=/usr/lib/tls/libevent-1.4.so.2
12842: trying file=/usr/lib/x86_64/libevent-1.4.so.2
12842: trying file=/usr/lib/libevent-1.4.so.2
12842:
/usr/local/bin/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
查看LD_DEBUG帮助:
root@ubuntu:/usr/local/lib# LD_DEBUG=help /usr/local/bin/memcached
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
scopes display scope information
all all previous options combined
statistics display relocation statistics
unused determined unused DSOs
help display this help message and exit
To direct the debugging output into a file instead of standard output
a filename can be specified using the LD_DEBUG_OUTPUT environment variable.
就会产生一个log.XXXX的文件:
[gliang1@localhost Linux2.6_64]$ ls
log.15051