Centos7下交叉编译MQTT

mac2026-08-22  2

一.openssl

链接地址:ftp://ftp.openssl.org/source/

1解压:

tar -zxvf openssl-1.1.1d.tar.gz

2.配置参数

cd openssl-1.1.1d/

./config no-asm shared --prefix=$PWD/install --cross-compile-prefix=arm-none-linux-gnueabi-

参数解析:

    no-asm : Do not use assembler code     shared : 编译连接成动态库     --prefix=$PWD/install : 指定编译后安装路径     --cross-compile-prefix=arm-none-linux-gnueabi- : 指定交叉编译工具链

3.修改Makefile,删除Makefile中的所有-m64

4.编译

make make install

 5.查看编译结果

cd install ls

二.MQTT

链接地址:https://www.eclipse.org/paho/clients/c/

1.下载,编译

git clone https://github.com/eclipse/paho.mqtt.c.git cd org.eclipse.paho.mqtt.c.git make

2.修改Makefile,添加openssl路径

INSTALL_DATA =  $(INSTALL) -m 644 DOXYGEN_COMMAND = doxygen

CFLAGS += -I./../openssl-1.1.1d/install/include LDFLAGS += -L./../openssl-1.1.1d/install/lib

MAJOR_VERSION = 1 MINOR_VERSION = 0  

3.编译

 make CC=arm-none-linux-gnueabi-gcc

 

建立环境期间遇见错误:

 undefined reference to `clock_gettime':

https://blog.csdn.net/qq_41925676/article/details/102870981

编译安装openssl报错:POD document had syntax errors at /usr/bin/pod2man line 69. make: *** [install_docs]:

https://blog.csdn.net/qq_41925676/article/details/102769820

 

参考链接:

https://www.baidu.com/link?url=PDw02u49rFDTAPdPUO2EWarWs2pN0en4PJs6Tg9BLOaJQ4mCeDO-X2_cdJpSXfWB&wd=&eqid=f5bd165d0012619c000000045dbd0127

最新回复(0)