在编译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/
相关推荐
●VON25 分钟前
AtomGit Flutter鸿蒙客户端:用户资料
flutter·华为·架构·跨平台·harmonyos·鸿蒙
●VON1 小时前
AtomGit Flutter鸿蒙客户端:数据模型
android·服务器·安全·flutter·harmonyos·鸿蒙
●VON2 小时前
AtomGit Flutter鸿蒙客户端:收藏仓库
flutter·架构·跨平台·harmonyos·鸿蒙
●VON2 小时前
AtomGit Flutter鸿蒙客户端:主题系统
javascript·flutter·华为·跨平台·harmonyos·鸿蒙
●VON5 小时前
AtomGit Flutter鸿蒙客户端:鸿蒙平台集成
flutter·华为·跨平台·harmonyos·鸿蒙
●VON6 小时前
AtomGit Flutter鸿蒙客户端:共享组件
java·flutter·华为·harmonyos·鸿蒙
●VON7 小时前
AtomGit Flutter鸿蒙客户端:本地存储
flutter·华为·跨平台·harmonyos·鸿蒙
●VON7 小时前
AtomGit Flutter鸿蒙客户端:Provider状态管理
flutter·华为·跨平台·harmonyos·鸿蒙
阿钱真强道8 小时前
28 鸿蒙LiteOS RK2206 LwIP Raw API 实现无阻塞UDP双向通信
udp·harmonyos·鸿蒙·lwip·开源鸿蒙
Davina_yu8 小时前
网络请求基础:使用http模块发起GET/POST请求(12)
harmonyos·鸿蒙·鸿蒙系统