1.ARM开发板的移植
安装openssl
<1>下载openssl:
首先需要移植openssl,因为编译mqtt时会用到openssl的lib库
官方下载网站:https://www.openssl.org/source/
<2>解压下载的安装包,进入解压后的文件夹:
tar -zxvf openssl-1.0.2l.tar.gz
cd openssl-1.0.2l/
<3>执行配置:
./config no-asm shared --prefix=$(pwd)/__install
no-asm:是在交叉编译过程中不使用汇编代码代码加速编译过程,因为它的汇编代码是对arm格式不支持的
shared :生成动态连接库
--prefix :指定make install后生成目录的路径,$(pwd)为当前文件夹
<4>修改Makefile文件:
CC=/(你的交叉编译工具链的路径)/arm-2009q3/bin/arm-none-linux-gnueabi-gcc
AR=/(你的交叉编译工具链的路径)/arm-2009q3/bin/arm-none-linux-gnueabi-ar $(ARFLAGS) r
ARFLAGS=
RANLIB=/(你的交叉编译工具链的路径)/arm-2009q3/bin/arm-none-linux-gnueabi-ranlib
(即将编译工具链更换成ARM开发板的交叉编译工具链)
CNF_CFLAGS=-pthread
CNF_CXXFLAGS=-std=c++11 -pthread
(即把标志位中的-m64去掉)
<5>编译安装:
make
make install
成功后,在<3>中prefix配置的的文件夹下会有_install的文件夹,其中include为头文件,lib为程序运行中用到的库