1. 程式人生 > >error while loading shared libraries: libevent-2.1.so.6 的解決辦法

error while loading shared libraries: libevent-2.1.so.6 的解決辦法

執行 memcached 啟動命令時,報錯,提示:error while loading shared libraries: libevent-2.1.so.6: cannot open shared object file: No such file or directory

檢視 memcached 命令缺失什麼庫
ldd /usr/local/memcached/bin/memcached

ldd /usr/local/memcached/bin/memcached

 結果: libevent-2.1.so.6 模組找不到

檢視 libevent-2.1.so.6 是否存在
locate libevent-2.1.so.6

locate libevent-2.1.so.6

 結果: 系統已經安裝了該模組,在路徑 /usr/local/lib/

檢視 memcached 查詢依賴庫的路徑
LD_DEBUG=libs /usr/local/memcached/bin/memcached -v

LD_DEBUG=libs /usr/local/memcached/bin/memcached -v

 結果: 在 /lib64/ 目錄中查詢,所以找不到已經安裝好的

對映 libevent-2.1.so.6 到 /lib64 路徑中
ln -s /usr/local/lib/libevent-2.1.so.6 /usr/lib64/libevent-2.1.so.6

ln -s /usr/local/lib/libevent-2.1.so.6 /usr/lib64/libevent-2.1.so.6

結果:這樣處理後,memcached就可以搜尋到該檔案了

啟動memcached服務
/etc/init.d/memcached restart

/etc/init.d/memcached restart

此處會略有不同,因為提前已經安裝了memcache開機啟動指令碼