1. 程式人生 > >error while loading shared libraries錯誤的原因及解決方法

error while loading shared libraries錯誤的原因及解決方法

在linux下執行程式時,發現了error while loading shared libraries這種錯誤,一時間不知道解決辦法,在網上搜索,終於解決了:

./tests: error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory

出現這類錯誤表示,系統不知道xxx.so放在哪個目錄下,這時候就要在/etc/ld.so.conf中加入xxx.so所在的目錄。

一般而言,有很多的so會存放在/usr/local/lib這個目錄底下,去這個目錄底下找,果然發現自己所需要的.so

檔案。

所以,在/etc/ld.so.conf中加入/usr/local/lib這一行,儲存之後,再執行:/sbin/ldconfig –v更新一下配置即可。

參考這裡