Some problems and solutions when using mosquitto

Some problems and solutions when using mosquitto  

2015-07-01 16:25:44 | Category:  mqtt| Report| Font size subscription

Question 1: Problem description:

When compiling the mosquitto source code on centos7, the following problems occur:

 
  

make[1]: 进入目录“/home/jason/mosquitto-1.2/man”xsltproc mosquitto.8.xmlwarning: failed to load external entity "/usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl"compilation error: file manpage.xsl line 3 element importxsl:import : unable to load /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xslcompilation error: file mosquitto.8.xml line 4 element refentryxsltParseStylesheetProcess : document is not a stylesheetmake[1]: *** [mosquitto.8] 错误 5make[1]: 离开目录“/home/jason/mosquitto-1.2/man”make: *** [docs] 错误 2

It can be seen from the prompt that the cause of the problem at this time is that the file: manpage.xsl cannot be loaded: docbook.xsl, and the error prompt is also displayed in the absolute path:

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

Could not find this file under:

 docbook.xsl

Look at the file manpage.xsl again, follow the 3rd line as suggested, it really is this absolute address:

 
  

<!-- 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>

Find the file docbook.xsl through the command, and it is not found in this machine, so it is basically determined that this file cannot be found:

[root@localhost mosquitto-1.2]# find / -name docbook.xsl


Solution:

1. Install docbook-style-xsl

Use the command: yum -y install docbook-style-xsl

2. Check where the file docbook.xsl is installed:

E.g:

[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. After searching, modify the address in the red letter above to the corresponding position in the file manpage.xsl;

4. Recompile mosquitto, the problem has been solved!

Question 2: The dynamic library cannot be found when executing the mosquitto client program: 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

[Original] Some problems and solutions when using mosquitto - Xiaoyaozi - Xiaoyaozi said:

 

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

 adduser mosquitto

如下图:

[Original] Some problems and solutions when using mosquitto - Xiaoyaozi - Xiaoyaozi said:

 

问题四:

在修改mosquitto源码之后,换到centos环境下重新编译时可能会出现下面的问题:

mosquitto.c:271:2: 错误:缺少结尾的 " 字符
  snprintf(buf, 1024, "%s", CHANGESET);
  ^
mosquitto.c:271:37: 错误:expected expression before ‘)’ token
  snprintf(buf, 1024, "%s", CHANGESET);
                                     ^

该问题的原因是文件:changeset的格式不对,可在centos环境下,按照如下方式修改此文件的格式:

使用vi打开此文件,然后使用:

:set ff=unix
to reset the format of this file, then save and exit

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324842569&siteId=291194637
Recommended