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
相关推荐
提子拌饭13310 小时前
风息时钟:鸿蒙Flutter 实现的自然风格时钟应用
flutter·华为·架构·开源·harmonyos
小白学鸿蒙12 小时前
一加6T 如何刷openharmony6.1系统
openharmony·一加6t
浮芷.13 小时前
Flutter 框架跨平台鸿蒙开发 - AR动物互动应用
flutter·ar·harmonyos
加农炮手Jinx14 小时前
Flutter 组件 conventional 适配鸿蒙 HarmonyOS 实战:约定式提交标准,构建自动化版本治理与 CI/CD 质量治理架构
flutter·harmonyos·鸿蒙·openharmony
王码码203514 小时前
Flutter 三方库 appstream 的鸿蒙化适配指南 - 驾驭 Linux 生态元数据规范,打造高性能、标准化、国际化的 OpenHarmony 桌面应用商店分发基石
flutter·harmonyos·鸿蒙·openharmony
见山是山-见水是水14 小时前
Flutter 框架跨平台鸿蒙开发 - AR植物养护助手
flutter·华为·ar·harmonyos
autumn200515 小时前
Flutter 框架跨平台鸿蒙开发 - 历史人物对话
服务器·flutter·华为·harmonyos
autumn200515 小时前
Flutter 框架跨平台鸿蒙开发 - 社区闲置循环
flutter·华为·harmonyos
chenbin___16 小时前
在鸿蒙手机上,measure 和 measureInWindow 返回的 y / pageY 在滑动组件后值不变问题
华为·智能手机·harmonyos
浮芷.17 小时前
Flutter 框架跨平台鸿蒙开发 - 家庭健康监测云应用
科技·flutter·华为·harmonyos·鸿蒙