OpenHarmony源码选择qemu_small_system_demo类型编译,不能修改工具链用gcc类型编译,内核报错assert(ohos_build_compiler == "clang" == defined(LOSCFG_COMPILER_CLANG_LLVM)

liangzhijiang 显示全部楼层 发表于 2024-7-26 11:21:22

【问题描述】

1、【介绍问题现象和发生的背景】 下载了源码3.1release版本后,hb set选择qemu_small_system_demo类型编译,然后执行hb build -f可正常编译出镜像,并且qemu仿真运行。但是我想改成使用gcc工具链编译,内核会断言报错:

lzj@lzj-vmware:~/workspace/openHarmony/code-v3.1-Release/OpenHarmony$ hb build -f The target_cpu needs to be specified, default target_cpu=arm [OHOS INFO] Set cache size limit to 50.0 GB [OHOS INFO] root_out_dir=//out/arm_virt/qemu_small_system_demo [OHOS INFO] root_build_dir=//out/arm_virt/qemu_small_system_demo [OHOS INFO] root_gen_dir=//out/arm_virt/qemu_small_system_demo/gen [OHOS INFO] current_toolchain=//build/lite/toolchain:arm-linux-gnueabi-gcc [OHOS INFO] host_toolchain=//build/toolchain/linux:clang_x64 [OHOS INFO] [OHOS INFO] args: Namespace(platforms_config_file='/home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/out/preloader/qemu_small_system_demo/platforms.build', subsystem_config_file='/home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/out/preloader/qemu_small_system_demo/subsystem_config.json', example_subsystem_file=None, source_root_dir='/home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/', gn_root_out_dir='/home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/out/arm_virt/qemu_small_system_demo', build_platform_name='phone', build_xts=False, target_os='ohos', target_cpu='arm', os_level='small', ignore_api_check=['xts', 'common', 'developertest'], scalable_build=False) [OHOS INFO] [OHOS INFO] build configs generation is complete. [OHOS INFO] ohos_build_compiler: gcc [OHOS INFO] ohos_kernel_type: liteos_a [OHOS INFO] liteos_config_file: /home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/vendor/ohemu/qemu_small_system_demo/kernel_configs/debug.config [OHOS INFO] ERROR at //kernel/liteos_a/BUILD.gn:68:1: Assertion failed. [OHOS INFO] assert(ohos_build_compiler == "clang" == defined(LOSCFG_COMPILER_CLANG_LLVM), [OHOS INFO] ^----- [OHOS INFO] compiler not match! [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] hks_config_small.h [OHOS INFO] --------------------------------------------- [OHOS INFO] ccache summary: [OHOS INFO] cache hit (direct) : 0 [OHOS INFO] cache hit (preprocessed) : 0 [OHOS INFO] cache miss : 0 [OHOS INFO] hit rate: 0.00% [OHOS INFO] mis rate: 0.00% [OHOS INFO] --------------------------------------------- [OHOS INFO] file: /home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/out/arm_virt/qemu_small_system_demo/.ninja_log not exists [OHOS INFO] parse file fail [OHOS ERROR] Please check build log in /home/lzj/workspace/openHarmony/code-v3.1-Release/OpenHarmony/out/arm_virt/qemu_small_system_demo/build.log lzj@lzj-vmware:~/workspace/openHarmony/code-v3.1-Release/OpenHarmony$

2、【我尝试过的解决方法和结果】

我也有下载4.0release版的源码来看,发现/kernel/liteos_a/BUILD.gn也是有这句断言,导致只能使用clang工具链编译,不能使用gcc编译。

3、【希望解决的结果】

可以怎么修改,让qemu_small_system_demo编译使用的是gcc工具链,而不是clang工具链。

【运行环境】

使用的是VMware+ubuntu2204的环境 SDK版本:code-v3.1-Release

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

精彩评论1

fengyunrenwu

沙发 发表于 2024-8-14 17:45:36
eho‘start’&& export CCACHE_NOHASHDIR="true" && export CCACHE_SLOPPINESS="include_file_ctime" && ./build.sh--product-name qemu-arm-linux-min--ccache--jobs 4

可以使用以上命令,进行编译

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

返回顶部