Skip to content

Commit

Permalink
xcc/cmake: fix error message when TOOLCHAIN_VER is undefined
Browse files Browse the repository at this point in the history
The exact set of environment variables required by xt-xcc and xt-clang
is a bit of a dark magic and error-prone. TOOLCHAIN_VER is definitely
one of them and the error message was puzzling when TOOLCHAIN_VER was
undefined or not exported.

- Add TOOLCHAIN_VER to the list of variables in the error message

- Replace the vague "toolchain not found" in the error message with the
  more useful "XCC/install/tools//XtensaTools/bin/xt-xcc not found" where
  the double slash and comparison with the filesystem clearly point at
  where TOOLCHAIN_VER is missing.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb authored and henrikbrixandersen committed Feb 16, 2024
1 parent 5d458d1 commit 29d7f9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmake/compiler/xcc/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}${CC} PATHS ${TOOLCHAIN_HOME} NO
find_program(CMAKE_GCOV ${CROSS_COMPILE}gcov PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)

if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND)
message(FATAL_ERROR "Zephyr was unable to find the toolchain. Is the environment misconfigured?
message(FATAL_ERROR "Zephyr was unable to find ${CROSS_COMPILE}${CC}. Is the environment misconfigured?
User-configuration:
ZEPHYR_TOOLCHAIN_VARIANT: ${ZEPHYR_TOOLCHAIN_VARIANT}
Internal variables:
CROSS_COMPILE: ${CROSS_COMPILE}
TOOLCHAIN_HOME: ${TOOLCHAIN_HOME}
TOOLCHAIN_VER: ${TOOLCHAIN_VER}
")
endif()

Expand Down

0 comments on commit 29d7f9f

Please sign in to comment.