当前位置: 首页 > news >正文

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

http://www.xdnf.cn/news/417961.html

相关文章:

  • WSL 安装 Debian 12 后,Linux 如何安装 nginx ?
  • Boby家族之Smart Boby:你的智能编程助手
  • YOLOv11融合[AAAI2025]的PConv模块
  • [51单片机]---DS18B20 温度检测
  • 第六节第二部分:抽象类的应用-模板方法设计模式
  • vim 练习题
  • 苍穹外卖--新增菜品
  • 按键精灵ios脚本新增元素功能助力辅助工具开发(一)
  • 机器学习07-归一化与标准化
  • mybatis中${}和#{}的区别
  • 【RabbitMQ】工作队列和发布/订阅模式的具体实现
  • 微服务八股(自用)
  • React Native告别图标体积大手动更换慢的噩梦:让图标更新像修改文字一样简单
  • 聊一聊Electron中Chromium多进程架构
  • 数据结构day1
  • 使用 IntelliJ IDEA 和 Maven 创建 Spark 项目
  • 云原生|kubernetes|kubernetes的etcd集群备份策略
  • 高防服务器部署实战:从IP隐匿到协议混淆
  • Scala和Go差异
  • 【面试 · 三】react大集合(类式/函数式)
  • 需求与技术实现不匹配,如何协调
  • 【 Redis | 实战篇 秒杀实现 】
  • 在虚拟机Ubuntu18.04中安装NS2教程及应用
  • Spark SQL 读取 CSV 文件,并将数据写入 MySQL 数据库
  • niushop单商户V5多门店版V5.5.0全插件+商品称重、商家手机端+搭建环境教程
  • Unity引擎源码-物理系统详解-其一
  • centos中libc.so.6No such file的解决方式
  • AI+企业应用级PPT生成(实战)
  • 初识XML
  • 软件测试(概念1)