1. 程式人生 > >error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file

1. 往/lib/usr/lib裡面加東西,是不用修改/etc/ld.so.conf的,但是完了之後要調一下ldconfig,不然這個library會找不到 2. 想往上面兩個目錄以外加東西的時候,一定要修改/etc/ld.so.conf,然後再呼叫ldconfig,不然也會找不到。 比如安裝了一個mysql到/usr/local/mysql,mysql有一大堆library在/usr/local/mysql/lib下面,這時就需要在/etc/ld.so.conf下面加一行/usr/local/mysql/lib,儲存過後ldconfig一下,新的library才能在程式執行時被找到.
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
很多時候安裝好了庫檔案,編譯通過,執行卻報“error while loading shared libraries: XXXX: cannot open shared object file: No such file or directory”。只要ldconfig一下就會發生神奇的事情。 3. 如果想在這兩個目錄以外放lib,但是又不想在/etc/ld.so.conf中加東西(或者是沒有許可權加東西)。那也可以,就是export一個全域性變數LD_LIBRARY_PATH,然後執行程式的時候就會去這個目錄中找library。一般來講這只是一種臨時的解決方案,在沒有許可權或臨時需要的時候使用,下次登入又要重新設定一遍。 LD_LIBRARY_PATH的意思是告訴loader在哪些目錄中可以找到共享庫. 可以設定多個搜尋目錄, 這些目錄之間用冒號分隔開. 比如安裝了一個mysql到/usr/local/mysql目錄下, 其中有一大堆庫檔案在/usr/local/mysql/lib下面, 則可以在.bashrc或.bash_profile或shell里加入以下語句即可:
export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH 
4. ldconfig做的這些東西都與執行程式時有關,跟編譯時一點關係都沒有。編譯的時候還是該加-L就得加,不要混淆了。 5. 總之,就是不管做了什麼關於library的變動後,最好都ldconfig一下,不然會出現一些意想不到的結果。不會花太多的時間,但是會省很多的事。
./configure
make
make install
[[email protected] libusb-1.0.8]# ldconfig
[[email protected] libusb-1.0.8]# ldconfig -v | grep libusb
        libusb-1.0.so.0 -> libusb-1.0.so.0.0.0
        libusb-0.1.so.4 -> libusb-0.1.so.4.4.4
        libusbpp-0.1.so.4 -> libusbpp-0.1.so.4.4.4
6.如果程式需要的庫檔案比系統目前存在的村檔案版本低,可以做一個連結 比如:
error while loading shared libraries: libncurses.so.4: cannot open shared
object file: No such file or directory
ls /usr/lib/libncu*
/usr/lib/libncurses.a   /usr/lib/libncurses.so.5
/usr/lib/libncurses.so  /usr/lib/libncurses.so.5.3
可見雖然沒有libncurses.so.4,但有libncurses.so.5,是可以向下相容的 建一個連結就好了
ln -s /usr/lib/libncurses.so.5.3 /usr/lib/libncurses.so.4
7.
gcc test.c -o test -levent
程式自動去找libevent.so,libevent.so只是一個符號連結。它指向檔案libevent.2.0.so.5,這通常也是符號連結,指向libevent.2.0.so.5.1.19,它才是真正的實現庫函式和結構體的檔案。 8.linux下標頭檔案預設搜尋路徑/usr/include/usr/local/include

相關推薦

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory解決

make scp AR object normal memcache window 2.0 HA 我是從其他服務器scp來的memcached(~~~整個文件夾的那種,windows用多了的後遺癥) 在準備運行 ./memcached -d -u root -l loca

error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file

1. 往/lib和/usr/lib裡面加東西,是不用修改/etc/ld.so.conf的,但是完了之後要調一下ldconfig,不然這個library會找不到 2. 想往上面兩個目錄以外加東西的時

error:while loading shared libraries: libevent-2.1.so.6: cannot open shared object file: No such file or directory

div usr dir deb 缺失 依賴庫 cal bug 模塊 執行 memcached 啟動命令時,報錯,提示:error while loading shared libraries: libevent-2.1.so.6: cannot open shared ob

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 命

修改mysql登陸時error while loading shared libraries: libncurses.so.5: cannot open shared object file

執行命令:mysql -u root -p 錯誤:error while loading shared libraries: libncurses.so.5: cannot open shared object file 分析:缺少 libncurses.so.5 解決方

linux中libevent-2.0.so.5 not found 解決 ldd 方法

安裝memcache時,需要建立檔案索引或者說檔案連線(link),類似windows下的快捷方式 啟動服務時出現 error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No su

error while loading shared libraries: libssl.so.6: cannot open shared object file

ldd yum check_tcp libssl.so.6 openssl098e-0.9.8e-20 [root@ ~]# /usr/local/nagios/libexec/check_tcp -H 127.0.0.1 80/usr/local/nagios/libexec/check

arm-none-linux-gnueabi/4.4.3/cc1: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

鬱悶了,安裝好了arm-linux-gcc的4.4.3版本,就是能能執行!!! 而且,在執行arm-linux-gcc -v的時候一切正常,醉了! 顯示說: /opt/Friendlyarm/arm-linux-gcc-4.4.3/bin/../libexec/gcc/arm-none-linux-

解決error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file

一、問題 執行hello程式時,用到了自己編寫的動態庫,在目錄/usr/local/lib目錄下,執行時出現 error while loading shared libraries: libhello.so.1: cannot open shared object file: No s

執行Visual Studio code,遇到error while loading shared libraries: libXss.so.1: cannot open shared object

執行Visual Studio Code,遇到錯誤如下: [[email protected] VSCode-linux-x64]# ./code  ./code: error while loading shared libraries: libXss.so.1

error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

今天重新配置環境的時, 在啟動nginx時出現這樣一個錯誤   解決方法   64位系統:  ln -s /usr/local/lib/libpcre.so.1 /lib64   32位系統:  ln -s /usr/local/lib/libpcre.so.1 /l

mysql安裝報錯error while loading shared libraries: libaio.so.1: cannot open shared object file: No such

使用ubantu安裝mysql時,出現報錯 [email protected]:/home/soft/mysql-5.6.41-linux-glibc2.12-x86_64# ./scripts/mysql_install_db --user=mysql --da

mysq安裝錯誤:error while loading shared libraries: libaio.so.1: cannot open shared object file: No such

centos6安裝mysq5.6 錯誤資訊:Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object

解決:CentOS下的 error while loading shared libraries: libmysqlclient.so.16: cannot open shared object fi

你看到的這個文章來自於http://www.cnblogs.com/ayanmw 進入別人的centos,輸入命令 mysql mysqladm都會報錯,缺少這個共享庫 libmysqlclient.so.16 。 查詢下,一般都是ldconfig 沒有找到共享庫的位置,或者 軟連結的問題,但是 都是

解決:CentOS下的 error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or dir

進入別人的centos,輸入命令 mysql mysqladm都會報錯,缺少這個共享庫 libmysqlclient.so.16 。 查詢下,一般都是ldconfig 沒有找到共享庫的位置,或者 軟連結的問題,但是 都是不治本的解決方案。 查詢 此檔案 相關的檔案: updatedb loca

error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file

error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file 2009-09-10 15:22 1.找到libmysqlclient.so.16所在的

解決 error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or

編譯android7.0出現問題: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory 解決方法: sudo apt-ge

error while loading shared libraries: libcudnn.so.7: cannot open shared object file: No such file or

1、錯誤:libcudnn.so.7 .build_release/tools/caffe .build_release/tools/caffe: error while loading shared libraries: libcudnn.so.7: cannot open shared ob

error while loading shared libraries: libnuma.so.1: cannot open shared object file

在初始化mysql5.7的時候,報以下錯誤 error while loading shared libraries: libnuma.so.1: cannot open shared objec

error while loading shared libraries: libcudart.so.7.5: cannot open shared ......解決方法

兩種方法: 第一種: 當libcudart.so.7.5存在,但是還是報錯的情況下,需要設定一下連結,按照下面的方法設定即可: 在 /etc/ld.so.conf.d/加入檔案 cuda.conf, 內容如下 /usr/local/cuda-6.5/lib64