[经验分享] [编译]如何解决“FAILED: .../sa_profile/merged_sa_profile.zip"的错误 原创

lakewater 显示全部楼层 发表于 2024-5-7 10:55:37
在执行全量编译rk3568的target时候,遇到下面的错误信息:


[OHOS ERROR] [20813/20847] ACTION //build/ohos/packages:phone_sa_profile_install_info(//build/toolchain/ohos:ohos_clang_arm)
[OHOS ERROR] FAILED: packages/phone/sa_profile/sa_install_info.json packages/phone/sa_profile/merged_sa_profile.zip
[OHOS ERROR] /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
[OHOS ERROR] Traceback (most recent call last):
[OHOS ERROR]   File "ohos/openharmony/out/rk3568/../../build/ohos/sa_profile/sa_profile_merge.py", line 131, in <module>
[OHOS ERROR]     sys.exit(main())
[OHOS ERROR]   File "ohos/openharmony/out/rk3568/../../build/ohos/sa_profile/sa_profile_merge.py", line 118, in main
[OHOS ERROR]     result_file_list = _sa_profile_merge(json_src_subsystem_file_list,
[OHOS ERROR]   File "ohos/openharmony/out/rk3568/../../build/ohos/sa_profile/sa_profile_merge.py", line 78, in _sa_profile_merge
[OHOS ERROR]     json_result_file_list = json_merge_tool.merge(sorted(json_sa_input_files),
[OHOS ERROR]   File "ohos/openharmony/build/ohos/sa_profile/sa_info_process/merge_sa_info.py", line 127, in merge
[OHOS ERROR]     return self.__merge(sa_info_filelist, output_dir)
[OHOS ERROR]   File "ohos/openharmony/build/ohos/sa_profile/sa_info_process/merge_sa_info.py", line 106, in __merge
[OHOS ERROR]     rearragement.sort(merged_file, merged_file)
[OHOS ERROR]   File "ohos/openharmony/build/ohos/sa_profile/sa_info_process/sort_sa_by_bootphase.py", line 284, in sort
[OHOS ERROR]     self.__parse_json_file(source_file)
[OHOS ERROR]   File "ohos/openharmony/build/ohos/sa_profile/sa_info_process/sort_sa_by_bootphase.py", line 59, in __parse_json_file
[OHOS ERROR]     data = json.load(file)
[OHOS ERROR]   File "ohos/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 "ohos/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 "ohos/openharmony/prebuilts/python/linux-x86/current/lib/python3.10/json/decoder.py", line 340, in decode
[OHOS ERROR]     raise JSONDecodeError("Extra data", s, end)
[OHOS ERROR] json.decoder.JSONDecodeError: Extra data: line 56 column 2 (char 1878)

从上面错误中,看不出来是哪个文件造成的,考虑在python代码中添加打印语句来判断执行到哪一个文件出现错误,打印语句如下:


在merge_sa_info.py", line 106 中加上打印文件名信息
            print(merged_file)

然后直接在命令行窗口执行上面的命令:
/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 ......

执行命令后,发现处理cloudfileservice.json文件的时候出现错误,直接打开这个文件,发现格式存在问题,修改这个文件,然后重新执行build命令,问题解决。

./build.sh --product-name rk3568 --ccache


总的来说,对于编译过程中出现的python代码执行的错误,可以添加调试语句来查找root cause,然后解决问题。



无用

©著作权归作者所有,转载或内容合作请联系作者

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

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

返回顶部