From bc0ae03f6028528b377aaa8c9658a1571ca3f075 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Wed, 13 May 2026 09:05:56 +0200 Subject: [PATCH] fix(esp_stdio): align VFS console force-link with the source-selection condition stdio_vfs.c (the sole definition of esp_vfs_include_console_register) is only added to the source list on non-Linux targets. The trailing target_link_libraries(... -u esp_vfs_include_console_register) was applied whenever CONFIG_VFS_SUPPORT_IO was enabled, including on the Linux host build where the symbol is not part of the link. Constrain the force-undef to the same condition that opts the defining source in. --- components/esp_stdio/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/esp_stdio/CMakeLists.txt b/components/esp_stdio/CMakeLists.txt index b929cc4e4a7..f4253624659 100644 --- a/components/esp_stdio/CMakeLists.txt +++ b/components/esp_stdio/CMakeLists.txt @@ -27,7 +27,7 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${includes}) -if(CONFIG_VFS_SUPPORT_IO) +if(CONFIG_VFS_SUPPORT_IO AND NOT ${target} STREQUAL "linux") if(IDF_BUILD_V2) idf_component_include(vfs) @@ -63,6 +63,9 @@ if(CONFIG_VFS_SUPPORT_IO) endif() target_link_libraries(${COMPONENT_LIB} PRIVATE idf::vfs) - # Make sure esp_stdio_register gets called at startup stage + # Make sure esp_stdio_register gets called at startup stage. + # The referenced symbol is defined in stdio_vfs.c, which is only added to + # the source list above on non-Linux targets; the force-undef is gated on + # the same condition for the link line to remain resolvable. target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_vfs_include_console_register") endif()