paho.mqtt.c 及 paho.mqtt.cpp编译问题记录

参照 README 中方法,安装所需库:

$ apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui
$ apt-get install fakeroot devscripts dh-make lsb-release
$ apt-get install libssl-dev
$ apt-get install doxygen graphviz

 问题 无法编译出 libpaho-mqtt3as.so 等库

原因分析:ssl 环境问题,但在其他设备中编译均可正常编译所有库,NANO 中需显式调用

解决方法:显式调用

root@ubuntu:/home/paho.mqtt.c/build# cmake .. -DPAHO_WITH_SSL=1
-- The C compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- CMake version: 3.13.1
-- CMake system name: Linux
-- Timestamp is 2024-10-21T06:04:25Z
-- Found OpenSSL: /usr/local/lib/libcrypto.so   
-- Configuring done
-- Generating done
-- Build files have been written to: /home/paho.mqtt.c/build
root@ubuntu:/homepaho.mqtt.c/build#

 注意:前提是已经安装过ssl

ubuntu 直接安装openssl(不能用时,编译 wget https://www.openssl.org/source/openssl-3.0.1.tar.gz )

显式调用后编译正常:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值