• Lv0
    粉丝0

积分0 / 贡献0

提问1答案被采纳0文章0

作者动态

    HDI接口驱动和服务编译错误,ACTION //build/ohos/packages:collect_notice_files__phone(//build/toolchain/ohos:ohos_clang_arm)

    [::::] 显示全部楼层 发表于 2024-12-11 10:35:34

    编译由IDL生成的xxx_driver和xxx_service的库时出现错误

    1.在做好驱动,开始封装HDI接口时,使用IDL,编译生成几个文件

    image.png

    其中最重要的四个途中红框框中,其中myled_interface_driver.cpp基本已经实现,只修改了最后“.moduleName =”字段,其他没有更改。完善了myled_interface_service.cpp。

    2.进行编译时,BUILD.gn如下

    # Copyright (c) 2022-2023 Huawei Device Co., Ltd.
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    
    HDF_CORE_PATH = "../../../hdf_core"
    import("//build/ohos.gni")
    import("$HDF_CORE_PATH/adapter/uhdf2/uhdf.gni")
    
    ohos_shared_library("libmyled_interface_service_1.0") {
      include_dirs = [
        "../interfaces/include",
        "include",
        "drivers_interface_myled:libmyled_stub_1.0",
        "../utils/include",
        "//third_party/bounds_checking_function/include",
      ]
    
      sources = [ 
        "src/myled_interface_service.cpp"
       ]
    
      deps = [ "../hal:mydev_hal" ]
    
      cflags = [
        "-Wall",
        "-Wextra",
        "-Werror",
        "-fsigned-char",
        "-fno-common",
        "-fno-strict-aliasing",
      ]
    
      if (is_standard_system) {
        external_deps = [
          "c_utils:utils",
          "drivers_interface_myled:myled_idl_headers",
          "hdf_core:libhdf_host",
          "hilog:libhilog",
          "hitrace:hitrace_meter",
        ]
      } else {
        external_deps = [ "hilog:libhilog" ]
      }
      external_deps += [ "ipc:ipc_single" ]
    
      install_images = [chipset_base_dir]
      subsystem_name = "hdf"
      part_name = "drivers_peripheral_myled"
    }
    
    
    ohos_shared_library("libmyled_driver") {
      include_dirs = [
        "../interfaces/include/",
        "../utils/include",
        "//third_party/bounds_checking_function/include",
      ]
      sources = ["src/myled_interface_driver.cpp"]
    
      cflags = [
        "-Wall",
        "-Wextra",
        "-Werror",
        "-fsigned-char",
        "-fno-common",
        "-fno-strict-aliasing",
      ]
    
      if (is_standard_system) {
        external_deps = [
          "c_utils:utils",
          "drivers_interface_myled:libmyled_stub_1.0",
          "drivers_interface_myled:myled_idl_headers",
          "hdf_core:libhdf_host",
          "hdf_core:libhdf_ipc_adapter",
          "hdf_core:libhdf_utils",
          "hdf_core:libhdi",
          "hilog:libhilog",
          "ipc:ipc_single",
        ]
      } else {
        external_deps = [
          "hilog:libhilog",
          "ipc:ipc_single",
        ]
      }
    
      shlib_type = "hdi"
      install_images = [chipset_base_dir]
      subsystem_name = "hdf"
      part_name = "drivers_peripheral_myled"
    }
    
    group("hdf_myled_service") {
      deps = [
        ":libmyled_driver",
        ":libmyled_interface_service_1.0",
      ]
    }
    

    进行编译时已完整生成相应的.so文件,但是在最后几步出现以下问题:

    [OHOS ERROR] [22975/23007] ACTION //build/ohos/packages:collect_notice_filesphone(//build/toolchain/ohos:ohos_clang_arm) [OHOS ERROR] FAILED: packages/phone/system_notice_files.zip [OHOS ERROR] /usr/bin/env ../../build/ohos/notice/collect_system_notice_files.py --install-info-file packages/phone/system_install_parts.json --output-file packages/phone/system_notice_files.zip --depfile gen/build/ohos/packages/collect_notice_files__phone.d --notice-root-dir packages/phone/NOTICE_FILES [OHOS ERROR] Traceback (most recent call last): [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/../../build/ohos/notice/collect_system_notice_files.py", line 96, in <module> [OHOS ERROR] sys.exit(main()) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/../../build/ohos/notice/collect_system_notice_files.py", line 84, in main [OHOS ERROR] collect_notice_files(args, tmp, depfiles) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/../../build/ohos/notice/collect_system_notice_files.py", line 46, in collect_notice_files [OHOS ERROR] module_info = json.load(file) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/prebuilts/python/linux-x86/current/lib/python3.10/json/init.py", line 293, in load [OHOS ERROR] return loads(fp.read(), [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/prebuilts/python/linux-x86/current/lib/python3.10/json/init__.py", line 346, in loads [OHOS ERROR] return _default_decoder.decode(s) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/prebuilts/python/linux-x86/current/lib/python3.10/json/decoder.py", line 337, in decode [OHOS ERROR] obj, end = self.raw_decode(s, idx=_w(s, 0).end()) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/prebuilts/python/linux-x86/current/lib/python3.10/json/decoder.py", line 355, in raw_decode [OHOS ERROR] raise JSONDecodeError("Expecting value", s, err.value) from None [OHOS ERROR] json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    [OHOS ERROR] Traceback (most recent call last): [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/containers/status.py", line 47, in wrapper [OHOS ERROR] return func(*args, **kwargs) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/modules/ohos_build_module.py", line 67, in run [OHOS ERROR] raise exception [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/modules/ohos_build_module.py", line 65, in run [OHOS ERROR] super().run() [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/modules/interface/build_module_interface.py", line 72, in run [OHOS ERROR] raise exception [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/modules/interface/build_module_interface.py", line 70, in run [OHOS ERROR] self._target_compilation() [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/modules/ohos_build_module.py", line 103, in _target_compilation [OHOS ERROR] self.target_compiler.run() [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/services/ninja.py", line 38, in run [OHOS ERROR] self._execute_ninja_cmd() [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/services/ninja.py", line 69, in _execute_ninja_cmd [OHOS ERROR] SystemUtil.exec_command( [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/util/system_util.py", line 64, in exec_command [OHOS ERROR] LogUtil.get_failed_log(log_path) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/util/log_util.py", line 193, in get_failed_log [OHOS ERROR] LogUtil.get_compiler_failed_log(log_path) [OHOS ERROR] File "/home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/build/hb/util/log_util.py", line 180, in get_compiler_failed_log [OHOS ERROR] raise OHOSException( [OHOS ERROR] exceptions.ohos_exception.OHOSException: COMPILE Failed! Please check error in /home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/error.log, and for more build information in /home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/build.log [OHOS ERROR]

    [OHOS ERROR] Code: 4000 [OHOS ERROR] [OHOS ERROR] Reason: COMPILE Failed! Please check error in /home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/error.log, and for more build information in /home/cyq/OHOS/OpenHarmony-v4.1-Release/OpenHarmony/out/rk3568/build.log [OHOS ERROR] [OHOS ERROR] Error Type: Ninja build error [OHOS ERROR] [OHOS ERROR] Description: An unknown error occurred while executing 'ninja -C'. [OHOS ERROR] [OHOS ERROR] Solution: no solution [OHOS ERROR] =====build error=====

    3.问题所在,当我将ohos_shared_library("libmyled_interface_service_1.0")和ohos_shared_library("libmyled_interface_service_1.0")修改为ohos_shared_library("myled_interface_service_1.0")和ohos_shared_library("myled_interface_service_1.0")就可以编译成功。两者生成的.so文件一模一样。

    4.最终尽管编译成功,host服务还是起不来,不知道是不是因为这个原因。请大佬们解惑!

    【运行环境】

    硬件:DAYU200

    版本:Openharmony 4.1 release

    您尚未登录,无法参与评论,登录后可以:
    参与开源共建问题交流
    认同或收藏高质量问答
    获取积分成为开源共建先驱

    Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

    返回顶部