mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
On some Windows systems, antivirus, endpoint-security or DLP/encryption software intercepts short-lived toolchain processes and strips their stdout when the build captures it through a pipe, while the same command prints its output normally when run by hand. The tool exits successfully but returns nothing, and each build step that reads toolchain output then failed with a different, cryptic error far from the real cause: - CMake configuration aborted with "Unknown arguments specified" in components/xtensa/project_include.cmake, or "check_expected_tool_version invoked with incorrect arguments" in components/esp_common. - ldgen turned the empty objdump output into an opaque pyparsing "Expected 'In archive'" traceback. - idf_tools.py silently reported the compiler/debugger version as "unknown", sending users into a fruitless reinstall loop. Detect the empty result at each consumer and fail (or warn) with an actionable message that names the likely cause and the remedy: - tools/cmake/compiler_query.cmake: new __compiler_query() helper runs a compiler query and fails with a clear error on empty or failed output. It is a standalone module included by both the cmakev1 and cmakev2 utilities, since the esp_common and xtensa project_include.cmake that call it are shared by both build systems. The xtensa if() arguments are now quoted so an empty result no longer collapses into a parse error. - tools/ldgen/ldgen.py: _run_objdump() rejects empty objdump output, and non-empty-but-unparsable section info is caught and re-raised as a clear LdGenFailure instead of a raw pyparsing traceback. - tools/idf_tools.py: empty version output now warns with the cause and returns UNKNOWN_VERSION instead of silently reporting "unknown". Closes https://github.com/espressif/esp-idf/issues/18727 Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
26 lines
1.1 KiB
CMake
26 lines
1.1 KiB
CMake
idf_build_get_property(idf_target_arch IDF_TARGET_ARCH)
|
|
if(NOT "${idf_target_arch}" STREQUAL "xtensa")
|
|
return()
|
|
endif()
|
|
|
|
# Check toolchain is configured properly in cmake
|
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
# without '--target' option 'clang -dumpmachine' prints default target arch and it might be not Xtensa
|
|
# so use `-print-targets` option
|
|
__compiler_query(dump_machine ${CMAKE_C_COMPILER} -print-targets)
|
|
else()
|
|
__compiler_query(dump_machine ${CMAKE_C_COMPILER} -dumpmachine)
|
|
endif()
|
|
message(STATUS "Compiler supported targets: ${dump_machine}")
|
|
|
|
if(NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL "Generic" AND "${dump_machine}" MATCHES "xtensa"))
|
|
# Sub-projects (e.g. ULP RISC-V on an xtensa target) may use a
|
|
# non-IDF toolchain provided by the parent build. Skip validation
|
|
# when a custom toolchain is explicitly declared.
|
|
if(IDF_CUSTOM_TOOLCHAIN)
|
|
return()
|
|
endif()
|
|
message(FATAL_ERROR "Internal error, toolchain has not been set correctly by project "
|
|
"(or an invalid CMakeCache.txt file has been generated somehow)")
|
|
endif()
|