欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > OpenHarmony 开源鸿蒙南向开发——linux下使用make交叉编译第三方库——mqtt库

OpenHarmony 开源鸿蒙南向开发——linux下使用make交叉编译第三方库——mqtt库

2025/5/18 19:41:54 来源:https://blog.csdn.net/qq_39172792/article/details/147926263  浏览:    关键词:OpenHarmony 开源鸿蒙南向开发——linux下使用make交叉编译第三方库——mqtt库

    准备工作

请依照这篇文章搭建环境

OpenHarmony 开源鸿蒙南向开发——linux下使用make交叉编译第三方库——环境配置_openharmony交叉编译-CSDN博客

下载

wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-3.5.9.tar.xz

解压

tar -xf 
mkdir ./out
cd ./out 

Cmake命令

这里需要更换一下目录

cmake .. \
-DPAHO_WITH_SSL=TRUE \
-DPAHO_BUILD_DOCUMENTATION=FALSE \
-DOPENSSL_ROOT_DIR=/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build \
-DOPENSSL_CRYPTO_LIBRARY=/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build/lib/libcrypto.so \
-DOPENSSL_INCLUDE_DIR=/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build/include \
-DOPENSSL_SSL_LIBRARY=/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build/lib/libssl.so \
-DCMAKE_C_COMPILER="/home/vtstar/Desktop/openharmony/sdk/sdk_linux_5.0.0.71/native/llvm/bin/clang" \
-DCMAKE_CXX_COMPILER="/home/vtstar/Desktop/openharmony/sdk/sdk_linux_5.0.0.71/native/llvm/bin/clang++" \
-DCMAKE_LINKER="/home/vtstar/Desktop/openharmony/sdk/sdk_linux_5.0.0.71/native/llvm/bin/ld.lld" \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=arm \
-DCMAKE_C_FLAGS="-fPIC -D__MUSL__=1 -march=armv7a -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/Libunistring/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/nettle/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/libtasn/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/gmp/out/32/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/gettext/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build/include --target=arm-linux-ohos" \
-DCMAKE_CXX_FLAGS="-fPIC -D__MUSL__=1 -march=armv7a -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/Libunistring/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/nettle/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/libtasn/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/gmp/out/32/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/gettext/out/32/build/include -I/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build/include --target=arm-linux-ohos" \
-DCMAKE_EXE_LINKER_FLAGS="-L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/gmp/out/32/lib -L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/Libunistring/out/32/build/lib -L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/nettle/out/32/build/lib -L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/libtasn/out/32/build/lib -L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/Libunistring/out/32/build/lib -L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/gettext/out/32/build/lib -L/home/vtstar/Desktop/openharmony/ThirtyPartRestore/openssl/openssl-1.1.1a/build/lib" \
-DCMAKE_INSTALL_PREFIX=./out

编译

cd ..
make -clean
make

编译成功

安装

make install

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词