关于执行memcached报错问题

执行
#/usr/local/memcached/bin/memcached
随后出现如下错误:
./memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory


找不到libevent-2.0.so.5文件


解决方法如下:

# whereis libevent-2.0.so.5
libevent-2.0.so: /usr/lib/libevent-2.0.so.5 /usr/local/lib/libevent-2.0.so.5

# ldd /usr/local/memcached/bin/memcached
linux-vdso.so.1 => (0x00007fffaeae1000)
libevent-2.0.so.5 => not found
librt.so.1 => /lib64/librt.so.1 (0x000000374e400000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000374e000000)
libc.so.6 => /lib64/libc.so.6 (0x000000374dc00000)
/lib64/ld-linux-x86-64.so.2 (0x000000374d400000)

# LD_DEBUG=libs ./memcached -v
17015: find library=libevent-2.0.so.5 [0]; searching
17015: search path=/usr/local/libevent-2.0.22-stable/lib/tls/x86_64:/usr/local/libevent-2.0.22-stable/lib/tls:/usr/local/libevent-2.0.22-stable/lib/x86_64:/usr/local/libevent-2.0.22-stable/lib (RPATH from file ./memcached)
17015: trying file=/usr/local/libevent-2.0.22-stable/lib/tls/x86_64/libevent-2.0.so.5
17015: trying file=/usr/local/libevent-2.0.22-stable/lib/tls/libevent-2.0.so.5
17015: trying file=/usr/local/libevent-2.0.22-stable/lib/x86_64/libevent-2.0.so.5
17015: trying file=/usr/local/libevent-2.0.22-stable/lib/libevent-2.0.so.5
17015: search cache=/etc/ld.so.cache
17015: search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64 (system search path)
17015: trying file=/lib64/tls/x86_64/libevent-2.0.so.5
17015: trying file=/lib64/tls/libevent-2.0.so.5
17015: trying file=/lib64/x86_64/libevent-2.0.so.5
17015: trying file=/lib64/libevent-2.0.so.5
17015: trying file=/usr/lib64/tls/x86_64/libevent-2.0.so.5
17015: trying file=/usr/lib64/tls/libevent-2.0.so.5
17015: trying file=/usr/lib64/x86_64/libevent-2.0.so.5
17015: trying file=/usr/lib64/libevent-2.0.so.5
17015:
./memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

# ln -s /usr/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5

# ldd /usr/local/memcached/bin/memcached
linux-vdso.so.1 => (0x00007fffd5504000)
libevent-2.0.so.5 => /usr/lib64/libevent-2.0.so.5 (0x00007f2c5c518000)
librt.so.1 => /lib64/librt.so.1 (0x000000374e400000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000374e000000)
libc.so.6 => /lib64/libc.so.6 (0x000000374dc00000)
/lib64/ld-linux-x86-64.so.2 (0x000000374d400000)

问题解决

原文地址:https://www.cnblogs.com/hjc4025/p/6774268.html