天天看點

mosquitto常見問題及其解決辦法

目錄

問題一:問題描述:

問題一解決辦法:

問題二:執行mosquitto用戶端程式時出現找不到動态庫:libmosquitto.so.1

問題二解決辦法:

​​​​​​​

  • 問題一:問題描述:

編譯mosquitto源碼時,出現以下問題:

make[1]: 進入目錄“/home/jason/mosquitto-1.2/man”
xsltproc mosquitto.8.xml
warning: failed to load external entity "/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl"
compilation error: file manpage.xsl line 3 element import
xsl:import : unable to load /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl
compilation error: file mosquitto.8.xml line 4 element refentry
xsltParseStylesheetProcess : document is not a stylesheet
make[1]: *** [mosquitto.8] 錯誤 5
make[1]: 離開目錄“/home/jason/mosquitto-1.2/man”
make: *** [docs] 錯誤 2
           

由提示可以看到,此時問題的原因在于在檔案:manpage.xsl裡面加載不了:docbook.xsl所緻,錯誤提示中也顯示在絕對路徑:

/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl

下找不到這個檔案:

 docbook.xsl

再看檔案manpage.xsl裡,按照所提示第3行,果然是這個絕對位址:

<!-- Set parameters for manpage xsl -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:import href="/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl" target="_blank" rel="external nofollow" />

<!-- Don't display notes list of link urls. -->

<xsl:param name="man.endnotes.list.enabled">0</xsl:param>

<xsl:param name="man.endnotes.are.numbered">0</xsl:param>

<!-- But if we do, set a base url for the relative links. -->

<xsl:param name="man.base.url.for.relative.links">http://mosquitto.org/man/</xsl:param>

<!-- Don't output filename when generating. -->

<xsl:param name="man.output.quietly" select="1"></xsl:param>

<!-- Generate ansi style function synopses. -->

<xsl:param name="man.funcsynopsis.style">ansi</xsl:param>

</xsl:stylesheet>

通過指令查找檔案 docbook.xsl,在本機中也沒有發現,是以基本可以确定是找不到這個檔案所緻:

 find / -name docbook.xsl
           
  • 問題一解決辦法:

1.安裝docbook-style-xsl

使用指令:

sudo apt-get install docbook-style-xsl
           
2.檢視檔案docbook.xsl被安裝到了哪裡:
find / -name docbook.xsl
           

3.搜尋到之後,将上面紅字中的位址修改到檔案manpage.xsl裡的對應位置;

4.再重新編譯mosquitto,問題已經解決!

  • 問題二:執行mosquitto用戶端程式時出現找不到動态庫:libmosquitto.so.1​​​​​​​

/mosquitto_sub: error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory
  • 問題二解決辦法:

編譯完mosquitto之後,進入到lib目錄下,将編譯之後的libmosquitto.so.1 拷貝到目錄/usr/local/lib下,執行如下指令:
cp libmosquitto.so.1 /usr/local/lib
           
然後再執行指令:
sudo ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1 ldconfig
           

繼續閱讀