Linux運行錯誤:error while loading shared libraries: xxx.so.0:cannot open shared object file: No such fil

來源:互聯網
上載者:User

標籤:

連結時可以通過-L和-l來指定自己的庫,因此連結可以通過,但是運行時,系統仍無法找到指定的庫,需要簡單配置一下。

解決方案1:

  可以直接在將自己的庫所在路徑添加到/etc/ld.so.conf檔案中。但一般這個檔案中的內容都是一句“include /etc/ld.so.conf.d/*.conf”,因此最好在/etc/ld.so.conf.d/目錄下建立一個檔案 , 如“xxx.conf”,然後將自己的庫所在路徑添加到這個conf檔案中。

修改完檔案後,以root身份運行   /sbin/ldconfig -v   。這一步必不可少,別丟了。

這時重新運行自己的程式,就沒有問題了。

解決方案2:

   如果知道連結庫檔案的版本號碼,可以在庫檔案所在目錄建立該庫檔案的軟連結檔案,如:

   我想連結 libSDL.so,可以用 ln -s libSDL.so libSDL-1.2.so.o來建立帶版本號碼的軟連結。然後重新運行程式就沒問題了。

Linux運行錯誤:error while loading shared libraries: xxx.so.0:cannot open shared object file: No such fil

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.