OpenHarmony开发者论坛

标题: 编译过程中出错 hb: command not found [打印本页]

作者: ramboxin    时间: 2024-9-5 13:08
标题: 编译过程中出错 hb: command not found
[md]### 【问题描述】

1. 介绍问题现象和发生的背景:编译niobe407时发生错误
2. 相关的代码(请勿使用截图)

   pack_all_in_one.sh代码

   ```

   hb_env_str=`hb env | grep "\[OHOS INFO\] root path"`
   root_path=${hb_env_str##* }

   hb_env_str=`hb env | grep "\[OHOS INFO\] board"`
   board_name=${hb_env_str##* }

   BOOT_LOADER_PATH=$root_path/out/$board_name/$board_name/bin/tw_boot.bin
   MERGE_TOOL_PATH=$root_path/out/$board_name/$board_name/bin/merge_bin
   APP_PATH=$root_path/out/$board_name/$board_name/OHOS_Image.bin
   OUTPUT_ALLINONE_PATH=$root_path/out/$board_name/$board_name/OHOS_Image_allinone.bin

   #合并bootloader程序
   $MERGE_TOOL_PATH $BOOT_LOADER_PATH $APP_PATH $OUTPUT_ALLINONE_PATH
   rm $APP_PATH
   mv $OUTPUT_ALLINONE_PATH $APP_PATH

   ```
3. 运行结果、错误截图

   [OHOS ERROR] [30/50] ACTION //device/board/talkweb/niobe407:pack_all_in_one(//build/lite/toolchain:arm-none-eabi-gcc)
   [OHOS ERROR] FAILED: obj/device/board/talkweb/niobe407/pack_all_in_one_build_ext_components.txt
   [OHOS ERROR] /home/device/rambo/OpenHarmony-4.0-Release/prebuilts/python/linux-x86/current//bin/python3 ../../../build/lite/build_ext_components.py --path=../../../device/board/talkweb/niobe407 --command=sh\ pack_tools/pack_all_in_one.sh --target_dir=/home/device/rambo/OpenHarmony-4.0-Release/out/niobe407/niobe407/obj/device/board/talkweb/niobe407/build.log --out_dir=/home/device/rambo/OpenHarmony-4.0-Release/out/niobe407/niobe407/error.log
   [OHOS ERROR] pack_tools/pack_all_in_one.sh: line 16: hb: command not found
   [OHOS ERROR] pack_tools/pack_all_in_one.sh: line 19: hb: command not found
   [OHOS ERROR] pack_tools/pack_all_in_one.sh: line 28: /out///bin/merge_bin: No such file or directory
   [OHOS ERROR] rm: cannot remove '/out///OHOS_Image.bin': No such file or directory
   [OHOS ERROR] mv: cannot stat '/out///OHOS_Image_allinone.bin': No such file or directory
   [OHOS ERROR] Traceback (most recent call last):
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/services/ninja.py", line 49, in _execute_ninja_cmd
   [OHOS ERROR]     SystemUtil.exec_command(
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/util/system_util.py", line 63, in exec_command
   [OHOS ERROR]     raise OHOSException(
   [OHOS ERROR] exceptions.ohos_exception.OHOSException: Please check build log in /home/device/rambo/OpenHarmony-4.0-Release/out/niobe407/niobe407/build.log
   [OHOS ERROR]
   [OHOS ERROR] During handling of the above exception, another exception occurred:
   [OHOS ERROR]
   [OHOS ERROR] Traceback (most recent call last):
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/containers/status.py", line 47, in wrapper
   [OHOS ERROR]     return func(*args, **kwargs)
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/modules/ohos_build_module.py", line 67, in run
   [OHOS ERROR]     raise exception
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/modules/ohos_build_module.py", line 65, in run
   [OHOS ERROR]     super().run()
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/modules/interface/build_module_interface.py", line 72, in run
   [OHOS ERROR]     raise exception
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/modules/interface/build_module_interface.py", line 70, in run
   [OHOS ERROR]     self._target_compilation()
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/modules/ohos_build_module.py", line 103, in _target_compilation
   [OHOS ERROR]     self.target_compiler.run()
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/services/ninja.py", line 38, in run
   [OHOS ERROR]     self._execute_ninja_cmd()
   [OHOS ERROR]   File "/home/device/rambo/OpenHarmony-4.0-Release/build/hb/services/ninja.py", line 52, in _execute_ninja_cmd
   [OHOS ERROR]     raise OHOSException('ninja phase failed', '4000')
   [OHOS ERROR] exceptions.ohos_exception.OHOSException: ninja phase failed
   [OHOS ERROR]
   [OHOS ERROR] Code:      4000
   [OHOS ERROR]
   [OHOS ERROR] Reason:    ninja phase failed
   [OHOS ERROR]
   [OHOS ERROR] Solution:  Please check the compile log at out/{compiling product}/build.log, If you could analyze build logs.
   [OHOS ERROR]            Or you can try the following steps to solve this problem:
   [OHOS ERROR]              1. cd to OHOS root path
   [OHOS ERROR]              2. run 'hb clean --all' or 'rm -rf out build/resources/args/*.json'.
   [OHOS ERROR]              3. repo sync
   [OHOS ERROR]              4. repo forall -c 'git lfs pull'
   [OHOS ERROR]              5. bash build/prebuilts_download.sh
   [OHOS ERROR]              6. rebuild your product or component
   [OHOS ERROR]
   [OHOS ERROR]            If you still cannot solve this problem, you could post this problem on:
   [OHOS ERROR]              https://gitee.com/openharmony/build/issues
   [OHOS ERROR]
   =====build  error=====
4. 我尝试过的解决方法和结果

   [OHOS ERROR]              1. cd to OHOS root path
   [OHOS ERROR]              2. run 'hb clean --all' or 'rm -rf out build/resources/args/*.json'.
   [OHOS ERROR]              3. repo sync
   [OHOS ERROR]              4. repo forall -c 'git lfs pull'
   [OHOS ERROR]              5. bash build/prebuilts_download.sh
   [OHOS ERROR]              6. rebuild your product or component

   上面试过没用,下面两个命令出错

   sudo ./build.sh -p niobe407

   ./build.sh --product-name niobe407 --ccache

   hb build -f不能用
5. 我想要达到的结果

   顺利编译完成,有偿回答也可以。只要结果正确就行。

### 【运行环境】

硬件:
ROM版本:niobe407
DevEvoStudio版本:devicetool-linux-tool-4.0.0.400
SDK版本:
[/md]
作者: ramboxin    时间: 2024-9-5 17:15
另外,为什么niobe407的    "product_name": "niobe407", "ohos_version": "OpenHarmony 3.1"在OpenHarmony4.0中,不应该在OpenHarmony3.1中吗?那么既然在4.0中却又编译通不过?下载了OpenHarmony3.1,为什么3.1中却没有niobe407,把device vender拷贝过来后更编译通不过?为何为何?现在代码进程稀里哗啦,有没有大神帮帮忙,有偿也可以




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5