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
相关推荐
安好说AI15 分钟前
Flutter 三方库 adaptive_image_picker 的鸿蒙化适配指南:零权限选图、纯 Dart 裁剪与目标大小压缩
flutter·harmonyos
2501_919749032 小时前
华为鸿蒙免费PDF工具—小羊免费PDF
华为·pdf·harmonyos·鸿蒙
贾伟康4 小时前
【口算王|10】HarmonyOS ArkTS 语音报题实战:协调朗读、作答和页面生命周期
生命周期·harmonyos·arkts·语音交互·texttospeech
贾伟康5 小时前
【口算王|08】HarmonyOS ArkTS 分类训练实战:让年级与运算分类参数保持一致
harmonyos·arkts·数据建模·路由参数·分类训练
光锥智能5 小时前
华为新麒麟芯片、鸿蒙7问世,手机底层竞赛升级
华为·智能手机·harmonyos
贾伟康6 小时前
【口算王|09】HarmonyOS ArkTS 学习统计实战:计算连续训练和正确率趋势
harmonyos·arkts·数据可视化·preferences·学习统计
lqj_本人6 小时前
Flutter 鸿蒙实战:用 wakelock_plus 三方库给阅读页加上屏幕常亮
flutter·华为·harmonyos
aqi0017 小时前
鸿蒙版本的JSBridge兼容与安卓配套的H5啦
android·华为·harmonyos·鸿蒙·移动应用
熊猫钓鱼>_>18 小时前
Flutter app_settings 鸿蒙适配实战:Intent 体系到 Want 的跨越
flutter·华为·harmonyos·openharmony·intent·want
贾伟康20 小时前
【句匠|20】HarmonyOS ArkTS AppGallery 发布复查实战:核对包名、版本、设备、素材和离线声明
harmonyos·arkts·应用上架·appgallery·发布审核