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
相关推荐
大土豆的bug记录1 小时前
鸿蒙权限授权弹窗(推荐)
华为·harmonyos
马剑威(威哥爱编程)2 小时前
【鸿蒙开发案例篇】基于MindSpore Lite的端侧人物图像分割案例
华为·harmonyos
L、2183 小时前
Flutter + OpenHarmony + 区块链:构建去中心化身份认证系统(DID 实战)
flutter·华为·去中心化·区块链·harmonyos
遇到困难睡大觉哈哈4 小时前
Harmony os —— Data Augmentation Kit 知识问答实战全流程(流式 RAG 问答踩坑记录)
harmonyos·鸿蒙
L、2184 小时前
Flutter + OpenHarmony 全栈实战:打造“鸿蒙智联”智能家居控制中心(系列终章)
flutter·华为·智能手机·electron·智能家居·harmonyos
马剑威(威哥爱编程)6 小时前
【鸿蒙开发案例篇】火力全开:鸿蒙6.0游戏开发战术手册
华为·harmonyos
L、2187 小时前
Flutter + OpenHarmony 分布式能力融合:实现跨设备 UI 共享与协同控制(终极篇)
javascript·分布式·flutter·ui·智能手机·harmonyos
鸿蒙开发工程师—阿辉7 小时前
HarmonyOS 5 极致动效实验室: Canvas 高阶动画的实现
华为·harmonyos
鸿蒙开发工程师—阿辉7 小时前
HarmonyOS 5 极致动效实验室:给 UI 注入“物理动效”
ui·华为·harmonyos
fakerth7 小时前
【OpenHarmony】OpenHarmony ETS Utils实现
鸿蒙系统·openharmony