memcached – error while loading shared libraries: libevent-2.0.so.5

今天在64位centos上安装memcached。启动服务时出现 error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory。记录一下处理的方法。 看到这个错的时候感觉很奇怪,因为我之前已经下载安装过libevent了。为什么启动的时候会找不到呢?看看我的处理步骤:

一、再次确定libevent安装在了哪里

# 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

 二、看看memcached的依赖

# ldd memcached 
        linux-vdso.so.1 =>  (0x00007fff79ba0000)
        libevent-2.0.so.5 => not found
        librt.so.1 => /lib64/librt.so.1 (0x00000035c3e00000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00000035c3a00000)
        libc.so.6 => /lib64/libc.so.6 (0x00000035c3600000)
        /lib64/ld-linux-x86-64.so.2 (0x00000035c2e00000)
发现果然没有找到libevent-2.0.so.5。

三、看看memcached找依赖包的过程

# LD_DEBUG=libs ./memcached -v
     25352:     find library=libevent-2.0.so.5 [0]; searching
     25352:      search cache=/etc/ld.so.cache
     25352:      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)
     25352:       trying file=/lib64/tls/x86_64/libevent-2.0.so.5
     25352:       trying file=/lib64/tls/libevent-2.0.so.5
     25352:       trying file=/lib64/x86_64/libevent-2.0.so.5
     25352:       trying file=/lib64/libevent-2.0.so.5
     25352:       trying file=/usr/lib64/tls/x86_64/libevent-2.0.so.5
     25352:       trying file=/usr/lib64/tls/libevent-2.0.so.5
     25352:       trying file=/usr/lib64/x86_64/libevent-2.0.so.5
     25352:       trying file=/usr/lib64/libevent-2.0.so.5
     25352:
./memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
发现memcached去搜索的路径中果然没有我们libevent-2.0.so.5包所在的位置

四、建立软链,让memcached可以找到他要的libevent-2.0.so.5

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

 五、再次查看memcached的依赖

# ldd memcached               
        linux-vdso.so.1 =>  (0x00007fff309ff000)
        libevent-2.0.so.5 => /lib64/libevent-2.0.so.5 (0x00007fa18c72e000)
        librt.so.1 => /lib64/librt.so.1 (0x00000035c3e00000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00000035c3a00000)
        libc.so.6 => /lib64/libc.so.6 (0x00000035c3600000)
        /lib64/ld-linux-x86-64.so.2 (0x00000035c2e00000)
大功告成!这下已经找到了! 这是一个很典型的问题,处理思路更加典型。记录之,也方便后来人。

转载于:https://my.oschina.net/laichendong/blog/283804

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值