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/',
相关推荐
前端小小王4 小时前
pnpm、Yarn 和 npm 的区别?
前端·npm·node.js
Oneforlove_twoforjob4 小时前
【Linux】Centos7下载npm
linux·运维·npm
supermapsupport4 小时前
使用npm包的工程如何引入mapboxgl-enhance/maplibre-gl-enhance扩展包
前端·webpack·npm·supermap·mapboxgl
牛奔4 小时前
windows nvm 切换node版本后,npm找不到
前端·windows·npm·node.js
鸭梨山大。4 小时前
NPM组件包 vant部分版本内嵌挖矿代码
前端·安全·npm·node.js·vue
play_big_knife5 小时前
鸿蒙项目云捐助第二十八讲云捐助项目首页组件云数据库加载轮播图
数据库·华为·harmonyos·鸿蒙·云开发·鸿蒙开发·鸿蒙技术
蟾宫曲9 小时前
在 Vue3 项目中实现计时器组件的使用(Vite+Vue3+Node+npm+Element-plus,附测试代码)
前端·npm·vue3·vite·element-plus·计时器
秋雨凉人心9 小时前
简单发布一个npm包
前端·javascript·webpack·npm·node.js
哥谭居民000111 小时前
将一个组件的propName属性与父组件中的variable变量进行双向绑定的vue3(组件传值)
javascript·vue.js·typescript·npm·node.js·css3
bin915315 小时前
npm报错
前端·npm·node.js