openwrt交叉編譯mqtt


一、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++ 

無法識別正確的路徑;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM