Centos7下交叉编译MQTT

一.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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值