zephyr
zephyr copied to clipboard
cmake: fix utterly cryptic error handling in the -DSPARSE=y build
Fixes commit 7a85ff768385 ("add sparse support")
The sparse build needs (at least) two things:
- sparse to be in the PATH
- the environment variable REAL_CC to be defined and to match the value expected by CMake
Fix error messages when either condition is wrong.
- New error message when 1. is not satisfied:
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:12 (find_program):
Could not find CMAKE_C_COMPILER using the following names: cgcc
- Previous error "message" when 1. is not satisfied:
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:17 (message):
C compiler
ZSDK/xtensa-intel_s1000_zephyr-elf/bin/xtensa-intel_s1000_zephyr-elf-gcc
not found - Please check your toolchain installation
(the reported location DOES exist!)
- New error message when 2. is not satisfied:
CMake Error at zephyr/cmake/compiler/gcc/target.cmake:25 (message):
sparse's REAL_CC is undefined, it must be set to:
zsdk/xtensa-intel_s1000_zephyr-elf/bin/xtensa-intel_s1000_zephyr-elf-gcc
- Previous error "message" when 2. is not satisfied:
modules/hal/xtensa/include/xtensa/config/core.h:54:10:
error:unable to open 'core-isa.h'`
Also: stop using the same name REAL_CC for both the internal CMake variable and the external sparse parameter; they're two different things so name them differently. Environment variable messes are complicated enough.
Signed-off-by: Marc Herbert [email protected]
-
No idea why the "operation was cancelled" in the middle of test run https://github.com/zephyrproject-rtos/zephyr/actions/runs/3086675604/jobs/4991288674. Clearly unrelated.
-
Just for the record this was found while enabling sparse in SOF CI: https://github.com/thesofproject/sof/pull/6311
-
cc: @lucvoo (https://github.com/lucvoo/sparse), @keqiaozhang, @greg-intel
Thanks for patching something that is basically broken in its initial proposal, https://github.com/zephyrproject-rtos/zephyr/pull/43776#pullrequestreview-1023060702.
Just for the record, complete rework by @tejlmand in progress in
- #51212
- #52671