一、openssl交叉编译
1、 ./config no-asm shared --prefix=$PWD/install --cross-compile-prefix=mipsel-openwrt-linux-
修改Makefile,找到Makefile中的所有-m64的地方,然后删除(应该只有两处地方)
make
make install
二、paho.mqtt.c交叉编译
1、cmake . -DPAHO_BUILD_STATIC=TRUE -DCMAKE_C_COMPILER=/home/qifeng/sqf/openwrt-hiwooya-stable/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc -DCMAKE_CXX_COMPILER=/home/qifeng/sqf/openwrt-hiwooya-stable/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-g++ -DCMAKE_INSTALL_PREFIX=/home/qifeng/sqf/onenet_mqtt/paho.mqtt.c-master/build/output
2、make
上述步骤不能生成2个lib文件;**3cs.so、**3as.so文件;
不使用cmake,使用make文件;
需要解决的问题:采用mipsel-openwrt-linux-gcc编译需要指定include文件夹,在makefile中指定编译时没有被识别;
解决问题的办法:将交叉编译产生的libssl.so.1.0.0、libcrypto.so.1.0.0 、libpaho-mqtt3cs.so.1.0、libpaho-mqtt3c.so.1.0、libpaho-mqtt3as.so.1.0、libpaho-mqtt3a.so.1.0 6个环境依赖放入/usr/lib 将openssl 对应的include库放入 /usr/include/
进行编译;
解决warning: environment variable 'STAGING_DIR' not defined
sudo vi /etc/profile
export STAGING_DIR=/opt/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin:$STAGING_DIR
source /etc/profile
三、onenet_mqtt交叉编译
1、cmake . -DCMAKE_C_COMPILER=/home/qifeng/sqf/openwrt-hiwooya-stable/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc -DCMAKE_CXX_COMPILER=/home/qifeng/sqf/openwrt-hiwooya-stable/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-g++
无法识别正确的路径;