OpenHarmony 4.0 Release 编译异常处理

一、环境配置

编译环境:Ubuntu 20.04

OpenHarmony 软件版本:4.0 Release

设备平台:rk3568

二、下拉代码

参考官网步骤:
OpenHarmony 4.0 Release 源码获取

repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-4.0-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'

三、编译代码

参考官网构建步骤:
v4.0 Release 编译构建

 bash build/prebuilts_download.sh
./build.sh --product-name rk3568 --ccache

如果上述步骤一切顺利,编译通过,build log如下:

...
Please modify according to README.md
[OHOS INFO] rk3568 build success
[OHOS INFO] Cost time:  0:58:44
=====build  successful=====
2023-11-08 14:48:55
++++++++++++++++++++++++++++++++++++++++

四、下拉及编译中遇到的问题

4.1、repo: error: unable to resolve "fork_flow"

下拉代码执行报错

$ repo init -u https://gitee.com/openharmony/manifest -b master --no-repo-verify
Downloading Repo source from https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/
remote: Enumerating objects: 4885, done.
remote: Counting objects: 100% (4885/4885), done.
remote: Compressing objects: 100% (2425/2425), done.
remote: Total 8626 (delta 4312), reused 2460 (delta 2460), pack-reused 3741
Receiving objects: 100% (8626/8626), 4.16 MiB | 9.25 MiB/s, done.
Resolving deltas: 100% (5577/5577), done.
repo: warning: verification of repo code has been disabled;
repo will not be able to verify the integrity of itself.

repo: error: unable to resolve "fork_flow"
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

unable to resolve "fork_flow"" 表明repo工具无法解析名为 "fork_flow",实际上fork_flow是repo仓库的一个分支

repo源码:开源中国/repo

解决方案:

$ which repo	#查看repo安装路径
/home/xxx/bin/repo

$ sudo vim /home/xxx/bin/repo 
#REPO_REV = 'fork_flow' 改为 REPO_REV = 'fork_flow' 

4.2 ERROR: HTTP error 404 while getting http://repo.huaweicloud.com/repository/pypi/...

执行bash build/prebuilts_download.sh后出现如下报错

$ bash build/prebuilts_download.sh 
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: http://repo.huaweicloud.com/repository/pypi/simple
Collecting rich
  Obtaining dependency information for rich from http://repo.huaweicloud.com/repository/pypi/packages/8d/5f/21a93b2ec205f4b79853ff6e838e3c99064d5dbe85ec6b05967506f14af0/rich-13.5.2-py3-none-any.whl.metadata
  ERROR: HTTP error 404 while getting http://repo.huaweicloud.com/repository/pypi/packages/8d/5f/21a93b2ec205f4b79853ff6e838e3c99064d5dbe85ec6b05967506f14af0/rich-13.5.2-py3-none-any.whl.metadata
ERROR: 404 Client Error: Not Found for url: http://repo.huaweicloud.com/repository/pypi/packages/8d/5f/21a93b2ec205f4b79853ff6e838e3c99064d5dbe85ec6b05967506f14af0/rich-13.5.2-py3-none-any.whl.metadata
prebuilts_download start
...

无效url:http://repo.huaweicloud.com/repository/pypi/packages/...

解决方案:

使用其他国内(清华)镜像源替换华为的pypi源,修改如下:

# build/prebuilts_download.sh
-    pypi_url='http://repo.huaweicloud.com/repository/pypi/simple'
+    pypi_url='https://pypi.tuna.tsinghua.edu.cn/simple'

4.3 一直卡在start npm install, please wait.

执行bash build/prebuilts_download.sh后一直卡在start npm install, please wait.

分析prebuilts_download.sh代码发现是npm源的问题,于是替换npm默认url

解决方案:

使用国内(淘宝)镜像源替换华为npm源,修改如下:

# build/prebuilts_download.py
-    parser.add_argument('--npm-registry', default='https://repo.huaweicloud.com/repository/npm/',
+    parser.add_argument('--npm-registry', default='https://registry.npm.taobao.org/',
相关推荐
Andy醒17 小时前
HarmonyOS . 沉浸状态栏使用
harmonyos·鸿蒙
ac.char20 小时前
在 Ubuntu 系统上安装 npm 环境以及 nvm(Node Version Manager)
linux·ubuntu·npm
ZBY520311 天前
【Vue】 npm install amap-js-api-loader指南
javascript·vue.js·npm
️ 邪神1 天前
【Android、IOS、Flutter、鸿蒙、ReactNative 】自定义View
flutter·ios·鸿蒙·reactnative·anroid
RAY_CHEN.1 天前
vue3 pinia 中actions修改状态不生效
vue.js·typescript·npm
鸿蒙自习室2 天前
鸿蒙多线程开发——线程间数据通信对象02
ui·harmonyos·鸿蒙
SuperHeroWu72 天前
【HarmonyOS】鸿蒙应用接入微博分享
华为·harmonyos·鸿蒙·微博·微博分享·微博sdk集成·sdk集成
Ztiddler2 天前
【npm设置代理-解决npm网络连接error network失败问题】
前端·后端·npm·node.js·vue
三天不学习2 天前
前端工程化-node/npm/babel/polyfill/webpack 一文速通
前端·webpack·npm
郝晨妤3 天前
鸿蒙原生应用开发元服务 元服务是什么?和App的关系?(保姆级步骤)
android·ios·华为od·华为·华为云·harmonyos·鸿蒙