在编译OpenHarmony遇到third_party/libnl编译报错的修复办法

笔者是在WSL(Ubuntu 20.04)环境下编译OpenHarmony遇到的错误,究其原因是鸿蒙在将安装软件的步骤添加到了编译阶段,在编译阶段一般是非root用户,而安装软件需要root权限(或许要输入密码),因此报错。解决办法就是将编译阶段的安装步骤跳过,手动提前安装即可,详细步骤如下。

1、手动安装依赖(执行命令可能要输入密码):

bash 复制代码
sudo apt-get update
sudo apt-get install autoconf automake libtool -y

2、删除或者注释掉third_party/libnl/install.sh中的两条apt-get命令(大约在17、18行):

bash 复制代码
# apt-get update
# apt-get install autoconf automake libtool -y

3、在third_party/libnl/libnl/configure.ac中加入(大约在12行之后):

bash 复制代码
m4_pattern_allow([AC_MSG_WARN])
m4_pattern_allow([AC_MSG_ERROR])
m4_pattern_allow([PKG_CHECK_MODULES])

4、在third_party/libnl/libnl/configure.ac中注释或删除掉如下几行:

bash 复制代码
下面几行删掉或注释掉:
PKG_CHECK_MODULES([CHECK], [check >= 0.9.0],
[has_check="yes"],
[AC_MSG_WARN([*** Disabling building of unit tests])
has_check="no"])
AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes'])

随后加入如下代码:

bash 复制代码
# 硬编码设置变量值以跳过检查
has_check="no"
AM_CONDITIONAL(WITH_CHECK, [test "$has_check" = 'yes'])

5、在third_party/libnl/install.sh中16行加入,前提是需要将修改好后的configure.ac拷贝出来到install.sh同级目录

bash 复制代码
cp -arf configure.ac $1/libnl/
相关推荐
向哆哆1 天前
构建健康档案管理系统:Flutter × OpenHarmony 跨端实现就医记录展示
flutter·开源·鸿蒙·openharmony·开源鸿蒙
向哆哆1 天前
画栈 · 跨端画师接稿平台:基于 Flutter × OpenHarmony 的整体设计与数据结构解析
数据结构·flutter·开源·鸿蒙·openharmony·开源鸿蒙
向哆哆1 天前
构建 Flutter × OpenHarmony 跨端健康档案管理顶部横幅的实现与解析
flutter·开源·鸿蒙·openharmony
睿麒1 天前
鸿蒙app开发中 控制一个组件到安全区域
鸿蒙
向哆哆1 天前
构建跨端健康档案管理系统:Flutter × OpenHarmony 实战解析
flutter·开源·鸿蒙·openharmony·开源鸿蒙
熊猫钓鱼>_>1 天前
【开源鸿蒙跨平台开发先锋训练营】Day 15: 赋予应用生命力——React Native原生动效体系构建
react native·华为·开源·harmonyos·arkts·鸿蒙
向哆哆1 天前
用 Flutter × OpenHarmony 构建智能健康提醒应用:健康档案管理实战
flutter·开源·鸿蒙·openharmony·开源鸿蒙
全栈陈序员1 天前
基于华为云EulerOS搭建openJiuwen企业级AI Agent开发环境实战
harmonyos·鸿蒙
_waylau1 天前
首本鸿蒙架构师培养手册《鸿蒙架构师修炼之道》简介
华为·harmonyos·鸿蒙·鸿蒙系统·仓颉·cangjie
向哆哆1 天前
Flutter × OpenHarmony 实战 | 打造画栈平台的顶部横幅组件
flutter·开源·鸿蒙·openharmony·开源鸿蒙