kawaii MQTT部署踩坑记录

kawaii MQTT在Ubuntu部署踩坑记录

kawaii MQTT部署踩坑记录

最近在尝试复现韦东山的MQTT智能家居的项目,在ubantu部署kawaii mqtt时出现了点问题。首先就是直接从jiejieTop那里git下载下来的mqttclient在buid时会出现报错:

Scanning dependencies of target mc-mqttclient_static
In file included from /usr/include/x86_64-linux-gnu/sys/socket.h:26:0,
                 from /home/book/Documents/mqttclient/platform/linux/platform_net_socket.h:11,
                 from /home/book/Documents/mqttclient/network/nettype_tls.c:9:
/usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h:26:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’
 struct iovec
 ^~~~~~
network/CMakeFiles/mc-network_static.dir/build.make:86: recipe for target 'network/CMakeFiles/mc-network_static.dir/nettype_tls.c.o' failed
make[2]: *** [network/CMakeFiles/mc-network_static.dir/nettype_tls.c.o] Error 1
CMakeFiles/Makefile2:508: recipe for target 'network/CMakeFiles/mc-network_static.dir/all' failed
make[1]: *** [network/CMakeFiles/mc-network_static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

怀疑可能是因为宏定义冲突或者编译器标志差异???具体原因我也不清楚,即使我运行了sudo apt-get update之后,还是会出现同样的报错,大佬如果有知道的话,请在评论区指导一下小弟。
尝试了一些方法无法解决之后,还是决定使用老师学习资料压缩包doc_and_source_for_projects中的mqtt文件,这个经过测试之后可以成功编译,但是在测试的时候又遇到了问题。

book@100ask:~/Documents/mqttclient/mqttclient$ ./build/bin/emqx

welcome to mqttclient test...

[I] >> /home/book/Documents/mqttclient/mqttclient/mqttclient/mqttclient.c:1468 mqtt_list_subscribe_topic()... there are no subscribed topics...

提示没有已订阅的主题,但是test文件里明明订阅了topic1\2\3,这是因为没有成功连接上test中mqtt_set_host(client, “xxxx”);函数里作者提供的ip,所以并没有成功订阅。建议大家可以按照韦老师的方法,使用.\mosquitto.exe在自己的电脑创建一个broker,记得更改.\mosquitto.conf开放端口,因为他是默认只监听了本地回环地址的。最后成功在ubantu上运行了kawaii mqtt,开心ing!

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值