海思嵌入式开发-005-OpenHarmony源码编译问题

一、问题描述

按照链接拉取master源码,出现如下问题,打开build.log文件 提示相应位置的文件没找到。

The target_cpu needs to be specified, default target_cpu=arm
[OHOS INFO] Set cache size limit to 100.0 GB
[OHOS INFO] root_out_dir=//out/hispark_pegasus/wifiiot_hispark_pegasus
[OHOS INFO] root_build_dir=//out/hispark_pegasus/wifiiot_hispark_pegasus
[OHOS INFO] root_gen_dir=//out/hispark_pegasus/wifiiot_hispark_pegasus/gen
[OHOS INFO] current_toolchain=//build/lite/toolchain:riscv32-unknown-elf
[OHOS INFO] host_toolchain=//build/toolchain/linux:clang_x64
[OHOS INFO] build configs generation is complete.
[OHOS INFO] ERROR at //build/core/gn/BUILD.gn:54:14: Unable to load "/home/matata/OpenHarmony_master/out/hispark_pegasus/wifiiot_hispark_pegasus/build_configs/BUILD.gn".
[OHOS INFO]     deps = [ "$root_build_dir/build_configs:inner_kits" ]
[OHOS INFO]              ^-----------------------------------------
[OHOS INFO] ---------------------------------------------
[OHOS INFO] ccache summary:
[OHOS INFO] cache hit (direct)  : 0
[OHOS INFO] cache hit (preprocessed)  : 0
[OHOS INFO] cache miss  : 0
[OHOS INFO] hit rate:  0.00% 
[OHOS INFO] mis rate: 0.00% 
[OHOS INFO] ---------------------------------------------
[OHOS INFO] file: /home/matata/OpenHarmony_master/out/hispark_pegasus/wifiiot_hispark_pegasus/.ninja_log not exists
[OHOS INFO] parse file fail
[OHOS ERROR] Please check build log in /home/matata/OpenHarmony_master/out/hispark_pegasus/wifiiot_hispark_pegasus/build.log
scons: *** [out/hispark_pegasus/wifiiot_hispark_pegasus/Hi3861_wifiiot_app.out] Error -1

please check the compilation log: /home/matata/.deveco-device-tool/logs/build/build.log

后面看技术交流群的群友也有类似的问题
在这里插入图片描述

二、解决方案

2.1解决原理

因为OpenHarmony源码有Master分支,即主干分支,里面包含最新发布的代码,有很多功能特性都在开发、完善、测试中,而且每天都会有非常多的提交,因此代码可能不稳定。Master分支比较适合新功能的尝鲜体验或者日常开发;以及Release分支,即发布分支或LTs分支,是waster分支的子集,里面的代码可能会滞后Master分支多个版本。基本上是Master分支上开发完善、经过测试确认稳定之后的功能特性,才会同步到Release分支上,以供商业产品使用。目前,Release分支已有多个版本,商业公司可根据自己项目的需要选择合适的版本。

主要是目前master分支有这个问题,所以需要切换到release分支。

OpenHarmony源码下载地址:https://www.openharmony.cn/download
OpenHarmony发布版本获取源码方式:OpenHarmony Release Notes

2.2获取OpenHarmony 3.1.1 Release源码

  • 步骤1:注册码云gitee账号
  • 步骤2:在Ubuntu的用户目录下,分步执行下面的命令,安装git客户端git-lfs并配置用户信息。
sudo apt install git git-lfs curl -y
git config --global user.name "yourname"             # 你自己gitee的用户名
git config --global user.email "your-email-address"  # 你自己gitee绑定的邮箱地址
git config --global credential.helper store
  • 步骤3:在Ubuntu的用户目录下,分步执行下面的命,安装码云repo工具
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > repo
sudo cp repo /usr/local/bin/repo
sudo chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
  • 步骤4:分步执行下面的命令,配置python3环境
cd /usr/bin
sudo ln -s /usr/bin/python3.8  python
  • 步骤5:执行下面的命令,通过repo + https下载OpenHarmony主干代码
cd ~
mkdir OpenHarmony_master
cd OpenHarmony_master
repo init -u https://gitee.com/openharmony/manifest.git -b refs/tags/OpenHarmony-v3.1.1-Release --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
repo forall -c git checkout -b weekly_20220419
bash build/prebuilts_download.sh

2.3最后解决问题,编译成功。

在这里插入图片描述

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值