解決 Linux error while loading shared libraries: cannot open shared object file: No such file or directory,errorwhileloading

來源:互聯網
上載者:User

解決 Linux error while loading shared libraries: cannot open shared object file: No such file or directory,errorwhileloading

安裝最新版本Emqtt,參照官方文檔安裝後,執行報錯:

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

 

從互連網上找到了一些文章, 解決了我的問題,這裡整理貼一下,類似的問題應該都可以參照解決。

 

1.先在本地尋找一下檔案

命令:wheris libsctp.so.1

先尋找一下本地是否存在檔案,如果存在的話,直接跳到第三步,我這裡的結果是找不到。

 

2.然後google 一下 下載libsctp

這個網站上有很多so檔案下載: https://www.rpmfind.net/

https://www.rpmfind.net/linux/RPM/centos/6.8/x86_64/Packages/lksctp-tools-1.0.10-7.el6.i686.html

 

RPM安裝,參照

http://www.centoscn.com/CentOS/help/2013/1019/1906.html

 

安裝後wheris  libsctp.so.1

發現安裝在usr/lib下面了。

再次運行 ./bin/emqttd consle,還是報錯。

 

3.懷疑是環境變數 LD_LIBRARY_PATH的問題。

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

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

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

在我這裡,rpm後,so檔案安裝在了/usr/lib下,這個目錄下應該是不需要配置的。

需要配置的同學可以參見:

http://blog.csdn.net/sahusoft/article/details/7388617

在我這裡,/sbin/ldconfig 更新後還是報錯。不過錯誤資訊變了:

 wrong ELF class: ELFCLASS32

 

4.查詢後,發現應該是 32位,64位問題。我安裝的Emqttd是64位版本。

使用命令

file /usr/lib64/libsctp.so.1 發現是個連結到 `libsctp.so.1.0.17'

file /usr/lib64/libsctp.so.1.0.17,發現是個32位的檔案。

看起來是64位的Emqtt用不了32位的so檔案。

 

5. 重新google libsctp的64位版本,rpm安裝。安裝之前先rpm -e 卸載原來的32位版本。

安裝64位後,ldconfig 。再次運行,成功開啟emqtt服務,問題解決。

 

 

聯繫我們

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