error while loading shared libraries: libiconv.so.2

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   ar   檔案   art   sp   

最近調試Zabbix的時候出現了一個錯誤:

/etc/init.d/zabbix_agentd start Starting zabbix_agentd:  /opt/program/zabbix/sbin/zabbix_agentd: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory                     [FAILED]

原因分析:

ld提示找不到庫檔案,而庫檔案就在目前的目錄中。
連結器ld預設的目錄是/lib和/usr/lib,如果放在其他路徑也可以,需要讓ld知道庫檔案在哪裡。

 

方法1:

編輯/etc/ld.so.conf檔案,在新的一行中加入庫檔案所在目錄;

運行ldconfig,以更新/etc/ld.so.cache檔案;

方法2:

在/etc/ld.so.conf.d/目錄下建立任何以.conf為尾碼的檔案,在該檔案中加入庫檔案所在的目錄;

運行ldconfig,以更新/etc/ld.so.cache檔案;

 

本人覺得第二種辦法更為方便,對於原系統的改動最小。因為/etc/ld.so.conf檔案的內容是include /etc/ld.so.conf.d/*.conf。所以,在/etc/ld.so.conf.d/目錄下加入的任何以.conf為尾碼的檔案都能被識別到。

 

本人的作法: 

1. 將所有的使用者需要用到的庫放到/usr/loca/lib;  2. 在/etc/ld.so.conf.d/目錄下建立檔案usr-libs.conf,內容是:/usr/local/lib  3. #sudo ldconfig

ld.so.cache的更新是遞增式的,就像PATH系統內容變數一樣,不是從頭重建立立,而是向上累加。

除非重新開機,才是從零開始建立ld.so.cache檔案。

本文出自 “Nick” 部落格,請務必保留此出處http://nicking.blog.51cto.com/8167627/1551082

error while loading shared libraries: libiconv.so.2

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.