当前位置: 代码迷 >> 综合 >> 树莓派安装paho-mqtt,出现错误的解决步骤
  详细解决方案

树莓派安装paho-mqtt,出现错误的解决步骤

热度:73   发布时间:2023-12-05 15:31:40.0

0.说明

本篇主要是在树莓派上安装mqtt时出现错误,解决过程中错误依次依赖,导致安装过程非常繁琐,故写博客记录一下,蛀牙包括
paho-mqtt 、openssl、doxygen、cmake 等安装

1.下载paho-mqtt的源码:

链接:https://pan.baidu.com/s/1ES24ZFfF59Pu_ZPY9IzQlw
提取码:kigq
官方源码:https://github.com/eclipse/paho.mqtt.c
1.下载后解压然后进入文件,执行make命令
这时如果出现“出现未找到openssl/ssl.h”的错误则执行一下命令进行处理
sudo apt-get install libssl-dev build-essential zlibc libidn11-dev libidn11 minizip

2.然后make就能正常执行,此时执行第二部,sudo make install
可能会出现如下问题

install -m 644 build/output/doc/MQTTClient/man/man3/MQTTClient.h.3 /usr/local/share/man/man3
install: 无法获取"build/output/doc/MQTTClient/man/man3/MQTTClient.h.3" 的文件状态(stat): 没有那个文件或目录
make: [install] 错误 1 (忽略)
install -m 644 build/output/doc/MQTTAsync/man/man3/MQTTAsync.h.3 /usr/local/share/man/man3
install: 无法获取"build/output/doc/MQTTAsync/man/man3/MQTTAsync.h.3" 的文件状态(stat): 没有那个文件或目录
make: [install] 错误 1 (忽略)

查看build路径,发现没有生成doc文件夹,需要运行 make html 生成。

3.运行make html时,报错误 /bin/sh: 1: doxygen: not found,没有安装doxygen,按 这篇文章安装。(调到4执行)

接着 sudo make uninstall 去掉前面有错的安装,再 sudo make install 重新安装。

4.doxygen下载地址
链接:https://pan.baidu.com/s/1db_ohgQ9Eut56mpkewiRkQ
提取码:4ypg
或者:https://github.com/doxygen/doxygen.git
下载后正常执行一下命令安装即可

$ cd doxygen
$ mkdir build
$ cd build
$ cmake -G "Unix Makefiles" ....前面有空格)
$ make
$ sudo make install

可是我的在执行cmake -G "Unix Makefiles" 时出现错误

bash:cmake :命令未找到

5.安装cmake工具,
源码下载:链接:https://pan.baidu.com/s/144ECE8QA0ElbA37NLl0Mww
提取码:js5x
然后执行一下命令安装

 tar -xzvf cmake-2.6.4.tar.gzcd cmake-2.6.4./bootstrap    (需要等待一段时间)make			(需要等待一段时间)make install

安装完后回到第4步出错的地方
此时执行cmake -G "Unix Makefiles" ..可能出现如下错误:

-- Found PythonInterp: /usr/bin/python (found version "3.5.2") CMake Error at /usr/local/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find FLEX (missing: FLEX_EXECUTABLE) Call Stack (most recent call first): /usr/local/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-3.10/Modules/FindFLEX.cmake:217 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:84 (find_package) -- Configuring incomplete, errors occurred! See also "/home/weiwen/workspace/doxygen/build/CMakeFiles/CMakeOutput.log".

$ sudo apt-get install flex

Could NOT find BISON (missing: BISON_EXECUTABLE) Call Stack (most recent call first): /usr/local/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-3.10/Modules/FindBISON.cmake:252 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:85 (find_package) -- Configuring incomplete, errors occurred! See also "/home/weiwen/workspace/doxygen/build/CMakeFiles/CMakeOutput.log".

$ sudo apt-get install bison

参考链接:
https://blog.csdn.net/yamida/article/details/79428515
https://blog.csdn.net/fly_yr/article/details/49815705