在centos7上编译mosquitto源码时,出现问题解决办法

时间:2022-08-31 14:47:59

问题一:问题描述:

在centos7上编译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"/> <!-- 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,在本机中也没有发现,因此基本可以确定是找不到这个文件所致:

[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里的对应位置;

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



执行命令:

sudo ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1

ldconfig

即可


问题三: Invalid user 'mosquitto'.

[root@localhost src]# ./mosquitto
1437558553: Error: Invalid user 'mosquitto'.
两种解决办法:

(1)修改配置文件:mosquitto.conf ,增加登录的用户,例如当前登录用户为root

在centos7上编译mosquitto源码时,出现问题解决办法

 

(1)执行命令增加当前用户:

 adduser mosquitto

如下图:

在centos7上编译mosquitto源码时,出现问题解决办法