openharmony编译第三方库找不到sdk_info.json
opanharmony版本:3.1
在third_party中添加第三方库编译报错
[OHOS INFO] ERROR at //build/templates/cxx/cxx.gni:501:7: Script returned non-zero exit code.
[OHOS INFO] exec_script(external_deps_script, arguments, "string")
[OHOS INFO] ^----------
[OHOS INFO] Current dir: /home/openharmony/out/rk3568/
[OHOS INFO] Command: /usr/bin/env /home/openharmony/build/templates/common/external_deps_handler.py --external-deps //build/toolchain/ohos:ohos_clang_arm --parts-src-flag-file build
_configs/parts_src_flag.json --external-deps-temp-file gen/third_party/BehaviorTree.CPP/behavior_tree__behavior_tree_external_deps_temp.json --sdk-base-dir ../../sdk/ohos-arm --sdk-
dir-name sdk/ohos-arm --current-toolchain //build/toolchain/ohos:ohos_clang_arm
[OHOS INFO] Returned 1 and printed out:
[OHOS INFO]
[OHOS INFO] file '//build/toolchain/ohos/sdk_info.json' doesn't exist.
[OHOS INFO]
[OHOS INFO] stderr:
[OHOS INFO]
[OHOS INFO] Traceback (most recent call last):
[OHOS INFO] File "/home/openharmony/build/templates/common/external_deps_handler.py", line 239, in <module>
[OHOS INFO] sys.exit(main())
[OHOS INFO] File "/home/openharmony/build/templates/common/external_deps_handler.py", line 205, in main
[OHOS INFO] sdk_module_info, adapted_ok = _get_external_module_from_sdk(
[OHOS INFO] File "/home/openharmony/build/templates/common/external_deps_handler.py", line 73, in _get_external_module_from_sdk
[OHOS INFO] raise Exception("part '{}' doesn't exist in sdk modules.".format(
[OHOS INFO] Exception: part '//build/toolchain/ohos' doesn't exist in sdk modules.
[OHOS INFO]
[OHOS INFO] See //third_party/BehaviorTree.CPP/BUILD.gn:23:1: whence it was called.
[OHOS INFO] ohos_shared_library("behavior_tree") {
[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 INFO] ^--------------------------------------------------
[OHOS INFO] [{
import("//build/ohos.gni")
import("//build/toolchain/ohos/ohos_toolchain.gni")
config("bt_nowarn_config"){
cflags = [
"-Wno-implicit-function-declaration",
"-Wno-pointer-sign",
"-Wno-unused-variable",
]
}
config("bt_cflag_config"){
# cflags = [
# ]
ldflags = [
"-lm"
]
}
ohos_shared_library("behavior_tree") {
sources = [
"src/action_node.cpp",
"src/basic_types.cpp",
"src/behavior_tree.cpp",
"src/blackboard.cpp",
"src/bt_factory.cpp",
"src/decorator_node.cpp",
"src/condition_node.cpp",
"src/control_node.cpp",
"src/shared_library.cpp",
"src/shared_library_UNIX.cpp",
"src/tree_node.cpp",
"src/script_parser.cpp",
"src/xml_parsing.cpp",
"src/decorators/inverter_node.cpp",
"src/decorators/repeat_node.cpp",
"src/decorators/retry_node.cpp",
"src/decorators/subtree_node.cpp",
"src/decorators/delay_node.cpp",
"src/controls/if_then_else_node.cpp",
"src/controls/fallback_node.cpp",
"src/controls/parallel_node.cpp",
"src/controls/reactive_sequence.cpp",
"src/controls/reactive_fallback.cpp",
"src/controls/sequence_node.cpp",
"src/controls/sequence_star_node.cpp",
"src/controls/switch_node.cpp",
"src/controls/while_do_else_node.cpp",
"src/loggers/bt_cout_logger.cpp",
"src/loggers/bt_file_logger.cpp",
"src/loggers/bt_minitrace_logger.cpp",
"3rdparty/tinyxml2/tinyxml2.cpp",
"3rdparty/minitrace/minitrace.cpp",
]
configs = [
":bt_cflag_config",
":bt_nowarn_config",
]
include_dirs = [
"include",
"3rdparty/lexy/include",
]
external_deps = [
"//build/toolchain/ohos:ohos_clang_arm",
]
part_name = "behavior_tree"
}
看起来编译时缺少了一个名为
sdk_info.json
的文件,导致无法找到所需的部分。根据报错信息,似乎是在处理外部依赖时出了问题。建议检查以下几点:sdk_info.json
文件存在于//build/toolchain/ohos/
目录下。BUILD.gn
文件和ohos_part.gni
文件中的相关配置,确保没有错误或遗漏。如果以上步骤都正确,还是无法解决问题,可能需要进一步检查编译脚本和外部依赖处理的逻辑,以确保正确加载所需的部分信息。
你好,gn文件贴一下
Hello,您解决了吗? 我目前也遇到了这个问题!
您好,请问有解决这个问题吗