1.下载最新的mosquitto.1.4.10.tar.gz的源码
2.解压,打开config.mk。在文件顶部添加如下
CC=mipsel-openwrt-linux-gcc
CXX=mipsel-openwrt-linux-g++
CPP=mipsel-openwrt-linux-g++
AR=mipsel-openwrt-linux-ar
LD=mipsel-openwrt-linux-ld
文件末尾的prefix= 需要输出路径
strip=mipsel-openwrt-linux-strip 注意:要把mipsel-openwrt-linux-strip拷贝到/usr/bin下
3.去掉config.mk中一些选项
WITH_TLS:=no
WITH_TLS_PSK:=no
WITH_SRV:=no
WITH_UUID:=no
当然,如果你需要这些外部库就需要编译出来,并改为yes
4.make && make install
问题:
install -s --strip-program=mipsel-openwrt-linux-strip libmosquitto.so.1 /home/vmuser/mqtt_install/lib/libmosquitto.so.1
install: 无法运行mipsel-openwrt-linux-strip: 没有那个文件或目录
把
mipsel-openwrt-linux-strip拷贝到/usr/bin下