在编译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/
相关推荐
aqi0012 小时前
鸿蒙版本的电子书阅读APP开放源码啦
android·华为·ai编程·harmonyos·鸿蒙
万物智能信息科技2 天前
温湿度传感器驱动开发—【万物智能之开源鸿蒙OpenHarmony系统实战开发系列教程】
人工智能·驱动开发·华为·开源·harmonyos·鸿蒙
熊猫钓鱼>_>2 天前
Kotlin Multiplatform for OpenHarmony 实战:为 Landscapist 实现图片加载适配
开发语言·kotlin·华为云·ai编程·harmonyos·鸿蒙·openharmony
m0_738185822 天前
Flutter 鸿蒙化实战:qr_code_scanner_plus 适配 OpenHarmony,二维码扫描
flutter·华为·harmonyos·鸿蒙
2501_919749033 天前
华为鸿蒙免费记账与生活统计APP—小羊统计
华为·生活·harmonyos·鸿蒙
m0_738185823 天前
Flutter 鸿蒙化实战:qrcode_flutter 适配 OpenHarmony,二维码生成与识别
数码相机·flutter·华为·harmonyos·鸿蒙
万物智能信息科技3 天前
血氧心跳传感器MAX30100芯片驱动开发—【万物智能之开源鸿蒙OpenHarmony系统实战开发系列教程】
人工智能·驱动开发·华为·开源·harmonyos·鸿蒙
老陈说编程3 天前
1. 鸿蒙 (HarmonyOS) 2012 至 2026 年的发展历程
分布式·华为·个人开发·harmonyos·鸿蒙·鸿蒙系统·程序员创富
m0_738185823 天前
Flutter 鸿蒙化实战:open_app_settings 适配 OpenHarmony,一键跳转系统设置
flutter·华为·harmonyos·鸿蒙
m0_738185823 天前
Flutter 鸿蒙化实战:qr_code_scanner 适配 OpenHarmony,相机扫码实时识别
数码相机·flutter·华为·harmonyos·鸿蒙