Openharmony 4.0 Release编译失败修改

1 :X11/Xcursor/Xcursor.h’ file not found问题

报错日志:

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/x11_window.c:28:

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/internal.h:169:

[OHOS ERROR] ../../third_party/flutter/glfw/src/x11_platform.h:39:10: fatal error: ‘X11/Xcursor/Xcursor.h’ file not found

[OHOS ERROR] #include <X11/Xcursor/Xcursor.h>

[OHOS ERROR] ^~~~~~~~~~~~~~~~~~~~~~~

[OHOS ERROR] 1 error generated.

修复方法:安装libxcursor-dev

2. fatal error: ‘X11/extensions/Xrandr.h’ file not found

报错日志

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/x11_monitor.c:28:

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/internal.h:169:

[OHOS ERROR] ../../third_party/flutter/glfw/src/x11_platform.h:42:10: fatal error: ‘X11/extensions/Xrandr.h’ file not found

[OHOS ERROR] #include <X11/extensions/Xrandr.h>

[OHOS ERROR] ^~~~~~~~~~~~~~~~~~~~~~~~~

[OHOS ERROR] 1 error generated.

修复方法:安装libxrandr-dev

3.fatal error: ‘X11/extensions/Xinerama.h’ file not found

报错日志

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/xkb_unicode.c:28:

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/internal.h:169:

[OHOS ERROR] ../../third_party/flutter/glfw/src/x11_platform.h:48:10: fatal error: ‘X11/extensions/Xinerama.h’ file not found

[OHOS ERROR] #include <X11/extensions/Xinerama.h>

[OHOS ERROR] ^~~~~~~~~~~~~~~~~~~~~~~~~~~

[OHOS ERROR] 1 error generated.

修复方法:安装libxinerama-dev

4. [OHOS ERROR] Code: 4000 Reason: ninja phase failed+

报错日志

[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/services/ninja.py”, line 49, in _execute_ninja_cmd
[OHOS ERROR] SystemUtil.exec_command(
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/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/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/out/sdk/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/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/containers/status.py”, line 47, in wrapper
[OHOS ERROR] return func(*args, **kwargs)
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/modules/ohos_build_module.py”, line 67, in run
[OHOS ERROR] raise exception
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/modules/ohos_build_module.py”, line 65, in run
[OHOS ERROR] super().run()
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/modules/interface/build_module_interface.py”, line 72, in run
[OHOS ERROR] raise exception
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/modules/interface/build_module_interface.py”, line 70, in run
[OHOS ERROR] self._target_compilation()
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/modules/ohos_build_module.py”, line 103, in _target_compilation
[OHOS ERROR] self.target_compiler.run()
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/services/ninja.py”, line 38, in run
[OHOS ERROR] self._execute_ninja_cmd()
[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/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

修复方法:可能是因为内存不足导致的,可以增加swap分区后再试

5. [OHOS ERROR] Reason: product RK3568@None not found

报错日志

[OHOS ERROR] Traceback (most recent call last):

[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/containers/status.py”, line 47, in wrapper

[OHOS ERROR] return func(*args, **kwargs)

[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/util/product_util.py”, line 295, in get_product_info

[OHOS ERROR] raise OHOSException(f’product {product_name}@{company} not found’)

[OHOS ERROR] exceptions.ohos_exception.OHOSException: product RK3568@None not found

[OHOS ERROR]

[OHOS ERROR] Code: 0

[OHOS ERROR]

[OHOS ERROR] Reason: product RK3568@None not found

[OHOS ERROR]

[OHOS ERROR] Solution: UNKNOWN REASON

[OHOS ERROR]

=====build error=====

修复方法:检查RK3568命名是否正确,这里需要区分大小写,rk3568和RK3568不一样

6. [OHOS INFO] file ‘../../sdk/ohos-arm/miscdevice/sdk_info.json’ doesn’t exist

报错日志

OHOS INFO] Returned 1 and printed out:

[OHOS INFO]

[OHOS INFO] file ‘../../sdk/ohos-arm/miscdevice/sdk_info.json’ doesn’t exist.

[OHOS INFO]

[OHOS INFO] stderr:

[OHOS INFO]

[OHOS INFO] Traceback (most recent call last):

[OHOS INFO] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py”, line 259, in <module>

[OHOS INFO] sys.exit(main())

[OHOS INFO] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py”, line 225, in main

[OHOS INFO] sdk_module_info, adapted_ok = _get_external_module_from_sdk(

[OHOS INFO] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py”, line 74, in _get_external_module_from_sdk

[OHOS INFO] raise Exception(“part ‘{}’ doesn’t exist in sdk modules.”.format(

[OHOS INFO] Exception: part ‘miscdevice’ doesn’t exist in sdk modules.

[OHOS INFO]

[OHOS INFO] See //base/powermgr/battery_manager/services/BUILD.gn:24:1: whence it was called.

[OHOS INFO] ohos_shared_library(“batteryservice”) {

[OHOS INFO] ^————————————–

[OHOS INFO] See //build/ohos/ohos_part.gni:25:16: which caused the file to be included.

[OHOS INFO] _deps += [ get_label_info(module_label, “label_with_toolchain”) ]

…………..

[OHOS ERROR] Traceback (most recent call last):

[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/containers/status.py”, line 47, in wrapper

[OHOS ERROR] return func(*args, **kwargs)

[OHOS ERROR] File “/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/build/hb/services/gn.py”, line 178, in _execute_gn_gen_cmd

[OHOS ERROR] raise OHOSException(‘GN phase failed’, ‘3000’)

[OHOS ERROR] exceptions.ohos_exception.OHOSException: GN phase failed

[OHOS ERROR]

[OHOS ERROR] Code: 3000

[OHOS ERROR]

[OHOS ERROR] Reason: GN phase failed

修复方法:进入base\sensors\miscdevice目录,git status 检查目录下文件,如果有删除的文件,checkout 回来删除的文件,如果没有git没有记录,前往https://gitee.com/openharmony/sensors_miscdevice/tree/OpenHarmony-v4.0-Release/下载base\sensors\miscdevice目录下所有文件,和本地文件对比

7. Kernel BTF报错

报错日志

FAILED: load BTF from vmlinux: Unknown error -22make[2]: *** [/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/out/kernel/src_tmp/linux-5.10/Makefile:1229: vmlinux] Error 255

make[1]: *** [arch/arm64/Makefile:208: rk3568-toybrick-x0-linux.img] Error 2

make[1]: Leaving directory ‘/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/out/kernel/OBJ/linux-5.10’

make: *** [Makefile:185: __sub-make] Error 2

修复方法:关闭CONFIG_DEBUG_INFO_BTF后可以修复,但是关闭CONFIG_DEBUG_INFO_BTF会导致BPF无法正常使用。建议检查编译脚本,大概率是路径问题导致

#export PATH=../../../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/:$PATH

export PATH=/home/ubuntu/workspace/OpenHarmony-v4.0-Release/OpenHarmony/prebuilts/clang/ohos/linux-x86_64/llvm/bin/:$PATH

可以尝试先将相对路径改成绝对路径看是否能编译通过

8. file ‘../../sdk/ohos-arm64/image_framework/sdk_info.json’ doesn’t exist.

报错日志

ERROR at //build/templates/cxx/cxx.gni:1438:26 (//build/toolchain/linux:clang_x64): Script returned non-zero exit code.
handler_result = exec_script(external_deps_script, arguments, “string”)
^———-
Current dir: /home/forlinx/3588/openharmaony/out/sdk/
Command: /usr/bin/env /home/forlinx/3588/openharmaony/build/templates/common/external_deps_handler.py –external-deps ets_runtime:libark_jsruntime napi:ace_napi image_framework:image image_framework:image_native device_status:devicestatus_client graphic_2d:librender_service_client udmf:udmf_client udmf:udmf_data_napi kv_store:distributeddata_inner –parts-src-flag-file build_configs/parts_src_flag.json –external-deps-temp-file clang_x64/gen/foundation/arkui/ace_engine/interfaces/napi/kits/drag_controller/ace_engine__dragcontroller_static_ohos_external_deps_temp.json –sdk-base-dir ../../sdk/ohos-arm64 –sdk-dir-name sdk/ohos-arm64 –current-toolchain //build/toolchain/linux:clang_x64 –innerkits-adapter-info-file ../../build/ohos/inner_kits_adapter.json –component-override-map /home/forlinx/3588/openharmaony/out/sdk/build_configs/component_override_map.json
Returned 1 and printed out:

file ‘../../sdk/ohos-arm64/image_framework/sdk_info.json’ doesn’t exist.

stderr:

Traceback (most recent call last):
File “/home/forlinx/3588/openharmaony/build/templates/common/external_deps_handler.py”, line 259, in
sys.exit(main())
File “/home/forlinx/3588/openharmaony/build/templates/common/external_deps_handler.py”, line 225, in main
sdk_module_info, adapted_ok = _get_external_module_from_sdk(
File “/home/forlinx/3588/openharmaony/build/templates/common/external_deps_handler.py”, line 74, in _get_external_module_from_sdk
raise Exception(“part ‘{}’ doesn’t exist in sdk modules.”.format(
Exception: part ‘image_framework’ doesn’t exist in sdk modules.

See //foundation/arkui/ace_engine/interfaces/napi/kits/drag_controller/BUILD.gn:20:3: whence it was called.
ohos_source_set(target_name) {
^—————————–
See //foundation/arkui/ace_engine/interfaces/napi/kits/drag_controller/BUILD.gn:88:3: whence it was called.
napi_dragcontroller_static(“dragcontroller_static_” + item.name) {
^—————————————————————–
See //foundation/arkui/ace_engine/interfaces/napi/kits/napi_lib.gni:58:14: which caused the file to be included.
deps = [ “$ace_root/interfaces/napi/kits/${module_path}:${module_name}static${platform}” ]

修复方法:检查foundation/multimedia/image_framework,去官方网站下载对应版本的模块代码进行对比

9. 之前编译能通过,突然无法编译通过了

修复方法:可能是之前编译中断过导致的,rm -rf out/hb_args 然后重新编译。这只是你没有修改任何代码的情况下,如果修改了代码那可能是修改的代码导致的。

发表回复 0

Your email address will not be published. Required fields are marked *