OpenHarmony 4.0 源码编译hb 问题排查记录

OS:Ubuntu 22.04 x86_64

下载好Openharmony 4.0Beta2 的源码

复制代码
$ pip3 install ohos-build
$ cd openharmony-4.0b2
$ hb set
Traceback (most recent call last):
  File "/home/loongson/.local/bin/hb", line 8, in <module>
    sys.exit(main())
  File "/home/loongson/.local/lib/python3.10/site-packages/hb/__main__.py", line 49, in main
    topdir = find_top()
  File "/home/loongson/.local/lib/python3.10/site-packages/hb/__main__.py", line 37, in find_top
    raise Exception("Please call hb utilities inside source root directory")
Exception: Please call hb utilities inside source root directory

从错信息看是找到某个目录,hb 是python写的,所以打算看看源码是找个目录出错了,根据出错信息直接看源码文件。

复制代码
$ vim /home/loongson/.local/lib/python3.10/site-packages/hb/__main__.py

VERSION = "0.4.6"


def find_top():
    cur_dir = os.getcwd()
    while cur_dir != "/":
        hb_internal = os.path.join(cur_dir, 'build/lite/hb_internal')
        if os.path.exists(hb_internal):
            return cur_dir

        cur_dir = os.path.dirname(cur_dir)
    raise Exception("Please call hb utilities inside source root directory")

查看python 代码可知报错原因是没找到 build/lite/hb_internal,在OpenHamony 源码下确实没有发现有build/lite/hb_internal, 去OpenHarmony 源码仓发现build_lite这个仓库里面有,所以从这里下载一份到源码放到OpenHarmony 中去。

下载build_lite 源码, 从中复制hb_internal 到openharmony 的源码目录即可。

复制代码
$ cd ../
$ git clone https://gitee.com/openharmony/build_lite
$ cd build_lite
$ cp -rf hb_internal ../openharmony-4.0b2/build/lite

$ cd ../openharmony-4.0b2
相关推荐
前端世界3 小时前
从一个 entry 写到十几个模块:鸿蒙模块化开发的真实落地方案(含可运行 Demo)
华为·harmonyos
一只大侠的侠3 小时前
Flutter开源鸿蒙跨平台训练营 Day14React Native表单开发
flutter·开源·harmonyos
听麟3 小时前
HarmonyOS 6.0+ APP AR文旅导览系统开发实战:空间定位与文物交互落地
人工智能·深度学习·华为·ar·wpf·harmonyos
空白诗3 小时前
高级进阶React Native 鸿蒙跨平台开发:slider 滑块组件 - 音量调节器完整实现
react native·react.js·harmonyos
●VON3 小时前
HarmonyOS应用开发实战(基础篇)Day01-《ArkTS基本知识》
学习·华为·harmonyos·鸿蒙·von
BlackWolfSky3 小时前
鸿蒙高级课程笔记2—应用性能优化
笔记·华为·harmonyos
ujainu4 小时前
护眼又美观:Flutter + OpenHarmony 鸿蒙记事本一键切换夜间模式(四)
android·flutter·harmonyos
ujainu4 小时前
让笔记触手可及:为 Flutter + OpenHarmony 鸿蒙记事本添加实时搜索(二)
笔记·flutter·openharmony
一只大侠的侠4 小时前
Flutter开源鸿蒙跨平台训练营 Day 13从零开发注册页面
flutter·华为·harmonyos
森之鸟4 小时前
鸿蒙审核常见问题避坑指南_Scroll嵌套List_Grid滑动优化
华为·harmonyos