mosquitto 使用时出现的一些问题及其解决办法
問(wèn)題一:問(wèn)題描述:
在centos7上編譯mosquitto源碼時(shí),出現(xiàn)以下問(wèn)題:
?
?make[1]: 進(jìn)入目錄“/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] 錯(cuò)誤 5
make[1]: 離開(kāi)目錄“/home/jason/mosquitto-1.2/man”
make: *** [docs] 錯(cuò)誤 2
由提示可以看到,此時(shí)問(wèn)題的原因在于在文件:manpage.xsl里面加載不了:docbook.xsl所致,錯(cuò)誤提示中也顯示在絕對(duì)路徑:
?
/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl
下找不到這個(gè)文件:
?docbook.xsl
再看文件manpage.xsl里,按照所提示第3行,果然是這個(gè)絕對(duì)地址:
?
?<!-- 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"/>
<!-- 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>
?
?
通過(guò)命令查找文件?docbook.xsl,在本機(jī)中也沒(méi)有發(fā)現(xiàn),因此基本可以確定是找不到這個(gè)文件所致:
[root@localhost mosquitto-1.2]# find / -name docbook.xsl
?
解決辦法:
1.安裝docbook-style-xsl
使用命令:yum -y install docbook-style-xsl
2.查看文件docbook.xsl被安裝到了哪里:
例如:
[root@localhost tools]# find / -name docbook.xsl
/usr/share/sgml/docbook/xsl-stylesheets-1.78.1/epub/docbook.xsl
/usr/share/sgml/docbook/xsl-stylesheets-1.78.1/fo/docbook.xsl
/usr/share/sgml/docbook/xsl-stylesheets-1.78.1/html/docbook.xsl
/usr/share/sgml/docbook/xsl-stylesheets-1.78.1/manpages/docbook.xsl
/usr/share/sgml/docbook/xsl-stylesheets-1.78.1/xhtml/docbook.xsl
/usr/share/sgml/docbook/xsl-stylesheets-1.78.1/xhtml-1_1/docbook.xsl
3.搜索到之后,將上面紅字中的地址修改到文件manpage.xsl里的對(duì)應(yīng)位置;
4.再重新編譯mosquitto,問(wèn)題已經(jīng)解決!
?
問(wèn)題二:執(zhí)行mosquitto客戶(hù)端程序時(shí)出現(xiàn)找不到動(dòng)態(tài)庫(kù):libmosquitto.so.1
./mosquitto_sub: error while loading shared libraries: libmosquitto.so.1: cannot open shared object file: No such file or directory
?
執(zhí)行命令:
sudo ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1
和
ldconfig
即可
?
問(wèn)題三:?Invalid user 'mosquitto'.
?
?[root@localhost src]# ./mosquitto
1437558553: Error: Invalid user 'mosquitto'.
兩種解決辦法:
?
(1)修改配置文件:mosquitto.conf ,增加登錄的用戶(hù),例如當(dāng)前登錄用戶(hù)為root
(1)執(zhí)行命令增加當(dāng)前用戶(hù):
?adduser mosquitto
如下圖:
問(wèn)題四:
在修改mosquitto源碼之后,換到centos環(huán)境下重新編譯時(shí)可能會(huì)出現(xiàn)下面的問(wèn)題:
mosquitto.c:271:2: 錯(cuò)誤:缺少結(jié)尾的 " 字符
? snprintf(buf, 1024, "%s", CHANGESET);
? ^
mosquitto.c:271:37: 錯(cuò)誤:expected expression before ‘)’ token
? snprintf(buf, 1024, "%s", CHANGESET);
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
該問(wèn)題的原因是文件:changeset的格式不對(duì),可在centos環(huán)境下,按照如下方式修改此文件的格式:
使用vi打開(kāi)此文件,然后使用:
:set ff=unix
重新設(shè)置一下此文件的格式,然后保存退出即可
問(wèn)題五:xsltproc: Command not found
mosquitto編譯的時(shí)候出現(xiàn)問(wèn)題:xsltproc: Command not found
如下圖所示:
解決辦法:安裝libxslt
yum -y install libxslt
問(wèn)題六:
?
./mosquitto_internal.h:40:20: error: ares.h: No such file or directory
解決辦法:
- 方法1關(guān)掉:則要到configure.mk文件中,把配置項(xiàng)WITH_SRV關(guān)掉,再編譯就行了如下:
WITH_SRV=no
- 方法2啟用:
cd <SRC>?
wget http://c-ares.haxx.se/download/c-ares-1.10.0.tar.gztar xvf c-ares-1.10.0.tar.gz
cd c-ares-1.10.0
./configure
make
sudo make install
總結(jié)
以上是生活随笔為你收集整理的mosquitto 使用时出现的一些问题及其解决办法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Linux 服务器带宽异常跑满分析解决
- 下一篇: paho mqtt client调试记录