OpenHarmony开发者论坛

标题: OpenHarmony4.0Release在RK3568中使用集成的Mindspore报错 [打印本页]

作者: Koncheng    时间: 2024-5-9 13:37
标题: OpenHarmony4.0Release在RK3568中使用集成的Mindspore报错
[md]最近在尝试使用OpenHarmony4.0中集成的Mindspore Lite进行推理,按照[官方文档](https://gitee.com/openharmony/third_party_mindspore)提示的方法在BUILD.gn中添加了

```
include_dirs = [
    "//third_party/mindspore/mindspore-src/source/mindspore/lite/mindir/include"
]
external_deps = ["mindspore:mindir"]
```

但是会出现编译报错

```
[OHOS INFO] Traceback (most recent call last):
[OHOS INFO] File "/mydata/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py", line 259, in <module>
[OHOS INFO] sys.exit(main())
[OHOS INFO] File "/mydata/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py", line 200, in main
[OHOS INFO] external_module_desc_info = _get_external_module_info(
[OHOS INFO] File "/mydata/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py", line 62, in _get_external_module_info
[OHOS INFO] raise Exception(
[OHOS INFO] Exception: external dep module 'mindspore_lib' doesn't exist in part 'mindspore'.
[OHOS INFO]
[OHOS INFO] See //sample/mstest/BUILD.gn:2:1: whence it was called.
[OHOS INFO] ohos_executable("Mindsporetest") {
[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] ^--------------------------------------------------
```

于是修改external_deps为deps,并且使用了完全目录如下所示

```
import("//build/ohos.gni")
ohos_executable("Mindsporetest") {
  sources = [
    "src/main.c"
  ]
    include_dirs = [
        "//third_party/mindspore/mindspore-src/source/"
    ]
  cflags = []
  cflags_c = []
  cflags_cc = []
  ldflags = []
  configs = []
  deps =[]
  external_deps = []
  deps += ["//third_party/mindspore/mindspore-src/source/mindspore/lite:mindspore_lib"]

  part_name = "mstest"
  install_enable = true
}
```

编译报错发生了变化,如下所示

```
[OHOS INFO] file '../../sdk/ohos-arm/hilog_native/sdk_info.json' doesn't exist.
[OHOS INFO]
[OHOS INFO] stderr:
[OHOS INFO]
[OHOS INFO] Traceback (most recent call last):
[OHOS INFO]   File "/mydata/OpenHarmony-v4.0-Release/OpenHarmony/build/templates/common/external_deps_handler.py", line 259, in <module>
[OHOS INFO]     sys.exit(main())
[OHOS INFO]   File "/mydata/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 "/mydata/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 'hilog_native' doesn't exist in sdk modules.
[OHOS INFO]
[OHOS INFO] See //third_party/mindspore/mindspore-src/source/mindspore/lite/BUILD.gn:573:1: whence it was called.
[OHOS INFO] ohos_shared_library("mindspore_lib") {
[OHOS INFO] ^-------------------------------------
[OHOS INFO] See //sample/mstest/BUILD.gn:16:12: which caused the file to be included.
[OHOS INFO]   deps += ["//third_party/mindspore/mindspore-src/source/mindspore/lite:mindspore_lib"]
[OHOS INFO]            ^--------------------------------------------------------------------------
```

根据以往经验,是在产品解决方案中没有添加hilog_native,但是通过查找,发现hilog_native这个部件已经变成了hilog?所以在产品解决方案添加hilog无效。

有以下几个问题:

1. 在OpenHarmony中使用集成的Mindspore有没有具体案例,查找到的案例都是通过交叉编译实现的
2. 上面具体描述的问题有解决方案吗
[/md]




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