问题1.

//applications/standard/dlp_manager:dlp_manager_compile_app相关报错 
解答:尝试在编译的时候加上sdk,该报错说明编译的时候需要用到了系统的api

 

问题2.

[OHOS ERROR] [19622/36140] ACTION //base/global/system_resources/systemres:systemres_hap(//build/toolchain/ohos:ohos_clang_arm64)
[OHOS ERROR] FAILED: obj/base/global/system_resources/systemres/SystemResources.hap
[OHOS ERROR] /usr/bin/env ../../build/scripts/hapbuilder.py --depfile gen/base/global/system_resources/systemres/systemres_hap.d --hap-profile=@FileArg\(gen/base/global/system_resources/systemres/systemres_hap.metadata:root:hap_profile\) --hapsigner ../../developtools/hapsigner/dist/hap-sign-tool.jar --hap-packing-tool obj/developtools/packing_tool/jar/app_packing_tool.jar --hap-path obj/base/global/system_resources/systemres/SystemResources.hap --packaged-resources obj/base/global/system_resources/systemres/systemres_hap/resources.zip --packaged-js-assets obj/base/global/system_resources/systemres/systemres_hap/js_assets.zip --assets=@FileArg\(gen/base/global/system_resources/systemres/systemres_hap.metadata:root:assets\) --app-profile=@FileArg\(gen/base/global/system_resources/systemres/systemres_hap.metadata:root:app_profile\) --build-mode release --target-out-dir obj/base/global/system_resources/systemres --sign_hap_py_path /Openharmony/OpenHarmony-4.1-Release/build/scripts/app_sign.py --private-key-path 123456 --sign-algo SHA256withECDSA --certificate-profile ../../base/global/system_resources/systemres/SystemResources.p7b --keyalias OpenHarmony\ Application\ Release --keystore-path ../../developtools/hapsigner/dist/OpenHarmony.p12 --keystorepasswd 123456 --certificate-file ../../developtools/hapsigner/dist/OpenHarmonyApplication.pem --nodejs-path ../../prebuilts/build-tools/common/nodejs/current/bin/node --js2abc-js clang_x64/obj/arkcompiler/ets_frontend/es2panda/ts2abc.js --enable-ark
[OHOS ERROR] WARNNING ['root', 'app_profile'] is not in metadata file, set default ''
[OHOS ERROR] 06-25 10:22:36 INFO - Start sign-app
[OHOS ERROR] 06-25 10:22:38 INFO - certificate in profile: OpenHarmony Application Release
[OHOS ERROR] 06-25 10:22:40 INFO - Start to sign code.
[OHOS ERROR] 06-25 10:22:40 INFO - ../../developtools/hapsigner/dist/OpenHarmony.p12 is exist. Try to load it with given passwd
[OHOS ERROR] 06-25 10:22:41 INFO - Create a sign info successfully.
[OHOS ERROR] 06-25 10:22:41 INFO - sign-app failed
[OHOS ERROR] 06-25 10:22:41 ERROR - hap-sign-tool: error: Invalid CEN header (invalid zip64 extra data field size)
解答:报`*Invalid* *CEN* *header* *(invalid* *zip64* *extra* *data* *field* size)`异常,请更换Jdk版本,参见[JDK-8313765](https://bugs.openjdk.org/browse/JDK-8313765) 

 

 

问题3.

ERROR at //build/config/sanitizers/sanitizers.gni:385:7: Assertion failed.
​
assert(
​
^-----
​
Build targets in os_account should fully enable cfi(cfi, cfi_cross_dso, !debug). For local debug, try to build with '--gn-args allow_sanitize_debug=true' to bypass sanitize check. If this target distributedaccount cannot enable cfi, add the target to //vendor/industio/purple_pi_oh/security_config/sanitizer_check_list.gni in bypass_cfi_target_list.
解答:编译的时候加入此命令可以绕过看护机制--args='allow_sanitize_debug=true'

 

问题4.

全量编译后。我想进行部分模块代码修改,执行模块编译
​
./build.sh --product-name laphone –ccache --no-prebuilt-sdk  --build-target wukong
​
 
​
实际执行下来,也非常慢,感觉跟重新编译一样。
​
 
​
参考了网上其他方案,全量编译后使用ninja编译子模块,但报错:
​
ldh2015@WIN-LBSAO28000L:/mnt/wsl/data/develop_openharmony/openharmony4.1$ ninja -C /mnt/wsl/data/develop_openharmony/openharmony4.1/out/purple_pi_oh wukong
ninja: Entering directory `/mnt/wsl/data/develop_openharmony/openharmony4.1/out/purple_pi_oh'
ninja: error: obj/base/account/os_account/services/accountmgr/test/moduletest/common/bundle_manager_adapter_module_test.ninja:14: multiple rules generate obj/base/account/os_account/services/accountmgr/src/bundle_manager_adapter/bundle_manager_adapter_module_test/bundle_manager_adapter_proxy.o
解答:其实这里是重复构建了同一个目标,只需要hb-clean或者**-w dupbuild=warn**无视即可

 

问题5.

想在编译镜像的时候不从源码编译libril_vendor库 而是直接使用我已经编译好的 so 打包进img 
解答:不同厂商产品的方式可能有所不同,bundle.json中不添加libril_vendor就不会编译,新so,可配置gn指定参考如下
​
ohos_prebuilt_shared_library("libdisplay_buffer_vdi_impl") {
​
 source = "lib/libdisplay_buffer_vdi_impl.z.so"
​
 install_enable = true
​
 install_images = [ chipset_base_dir ]  //指定烧录到某个镜像
​
 subsystem_name = "子系统名"
​
 part_name = "部件名"
​
}

 

问题6.报错

[OHOS INFO] [5757/14021] STAMP obj/foundation/resourceschedule/resource_schedule_service/cgroup_sched/framework/process_group/libprocess_group.inputdeps.stamp
[OHOS INFO] [5758/14021] STAMP obj/foundation/resourceschedule/resource_schedule_service/ressched/interfaces/innerkits/ressched_client/ressched_client.inputdeps.stamp
[OHOS INFO] [5759/14021] STAMP obj/third_party/iptables/iptables.inputdeps.stamp
[OHOS INFO] [5760/14021] STAMP obj/third_party/iptables/iptables-restore.inputdeps.stamp
[OHOS INFO] [5761/14021] STAMP obj/third_party/iptables/iptables-save.inputdeps.stamp
[OHOS INFO] [5762/14021] STAMP obj/third_party/iptables/libxtables/libxtables.inputdeps.stamp
[OHOS INFO] [5763/14021] STAMP obj/third_party/jsoncpp/jsoncpp__check.stamp
[OHOS INFO] [5764/14021] STAMP obj/third_party/jsoncpp/jsoncpp_static.inputdeps.stamp
[OHOS INFO] [5765/14021] ACTION //third_party/libcoap:libcoap__check(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] [0/0] WARNING: //third_party/libcoap:libcoap depend part //third_party/bounds_checking_function:libsec_shared, need set part deps bounds_checking_function info to /home/cx/os/ohos_4.0/third_party/libcoap/bundle.json.

解答:针对报错build/compile_standard_whitelist.json third_deps_bundle_not_add":下添加这两个白名单 ,将这两个添加到third_deps_bundle_not_add下面

 

问题7.

使用 prebuilts/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc交叉编译器编译出来的可执行文件推到3568上为什么会执行不了呢,请教一下大佬要怎么编译呢

解答:1、写一个简单的test

img

2、编译:arm-linux-gnueabi-gcc test2.c -o test;

3、使用readelf -d test,发现test执行程序依赖了libc.so.6;虽然编译成功了,但是板子上没有这个库导致运行不了

4.arm-linux-gnueabi-gcc test2.c -static -o test 会静态编译出

img

 

5执行成功

 

  1. 报错

    [22864/22900] ACTION //build/ohos/packages:phone_sa_profile_install_info(//build/toolchain/ohos:ohos_clang_arm)
    FAILED: packages/phone/sa_profile/sa_install_info.json packages/phone/sa_profile/merged_sa_profile.zip 
    /usr/bin/env ../../build/ohos/sa_profile/sa_profile_merge.py --src-sa-install-info-file packages/phone/sa_profile/src_sa_install_info.json --no-src-sa-install-info-file packages/phone/sa_profile/sa_profile_binary_phone.zip --sa-output-dir packages/phone/sa_profile/merged_sa --merged-sa-profile packages/phone/sa_profile/merged_sa_profile.zip --sa-install-info-file packages/phone/sa_profile/sa_install_info.json --sa-info-install-dest-dir system/profile --target-cpu arm --depfile gen/build/ohos/packages/phone_sa_profile_install_info.d
    Traceback (most recent call last):
      解答: json文件合并出错了,导致解析文件有问题,尝试删除out下所有json文件再编译试试
    ​
    find ./out -name '*.json'|xargs rm   

     

问题8.

oh4.0 rk3568 如何json文件加到gn中编译到板子里
解答:import("//build/ohos.gni")
​
ohos_prebuilt_etc("hdf_audio_effect_json") {
  source = "audio_effect.json"
​
  relative_install_dir = "hdfconfig"
  install_images = [ chip_prod_base_dir ]
  subsystem_name = "hdf"
  part_name = "product_rk3568"
}
​
ohos_prebuilt_etc("hdf_audio_path_json") {
  source = "audio_paths.json"
​
  relative_install_dir = "hdfconfig"
  install_images = [ chipset_base_dir ]
  subsystem_name = "hdf"
  part_name = "product_rk3568"
}
​
ohos_prebuilt_etc("audio_policy_config") {
  if (target_cpu == "arm64") {
    source = "config/arm64/audio_policy_config.xml"
  } else {
    source = "config/arm/audio_policy_config.xml"
  }
  subsystem_name = "hdf"
  relative_install_dir = "audio"
  install_images = [ chipset_base_dir ]
  part_name = "product_rk3568"
}
​
group("hdf_audio_config") {
  deps = [
    ":audio_policy_config",
    ":hdf_audio_effect_json",
    ":hdf_audio_path_json",
  ]
}
​
group("hdi_service_st") {
  testonly = true
  deps = [ "//drivers/peripheral/audio/test/systemtest/hdi_service/rk3568:hdi_service_hardwaredependence" ]
}
 
​
这个是/vendor/hihope/dayu210/hals/audio/BUILD.gn下
在上面BUILD.gn 同目录下添加alsa_adapter.json文件,同时修改BUILD.gn
​
ohos_prebuilt_etc("hdf_alsa_adapter_json") {
source = "alsa_adapter.json"
​
relative_install_dir = "hdfconfig"
install_images = [ chipset_base_dir ]
subsystem_name = "hdf"
part_name = "product_rk3568"
}
​
group("hdf_audio_config") {
deps = [
":audio_policy_config",
":hdf_audio_effect_json",
":hdf_audio_path_json",
+ ":hdf_audio_adapter_json",
]
}

问题9.

oh4.0R rk3568 编译hello_composer 编译后没有在system/bin下
解答:hello_composer组件对应的BUILD.gn中是否添加了install_images = [ "system" ] 属性
Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐