Fix lives in: ESP-IDF (platform headers)
What the workaround does
We pass -Wno-undef to every vendored target (Abseil, protobuf, opentelemetry-cpp) via _esp_opentelemetry_apply_int_override in cmake/protobuf_setup.cmake:
# Applied to every vendored static/object/shared/module library:
-Wno-undef
Root cause
ESP-IDF v6 platform headers (assert.h, sys/time.h, pthread.h, and others) guard feature blocks with #if CONFIG_* Kconfig macros. When a Kconfig option is disabled, ESP-IDF omits the #define CONFIG_X 0 line from sdkconfig.h entirely — the symbol is simply absent. This means #if CONFIG_X expands to #if (undefined identifier), which GCC treats as #if 0 but emits a -Wundef diagnostic.
Abseil and protobuf include several ESP-IDF platform headers indirectly (through <time.h>, <pthread.h>, etc.). Under -Werror=all these -Wundef hits become hard errors, breaking the build.
This did not occur in ESP-IDF v5 because v5 always emitted #define CONFIG_X 0 for disabled Kconfig symbols in sdkconfig.h.
Proposed fix
ESP-IDF should restore the #define CONFIG_X 0 pattern for disabled Kconfig symbols, or guard its own platform headers with #ifdef CONFIG_X rather than #if CONFIG_X.
What we delete once fixed
- The
-Wno-undef entry in _esp_opentelemetry_apply_int_override in cmake/protobuf_setup.cmake
Fix lives in: ESP-IDF (platform headers)
What the workaround does
We pass
-Wno-undefto every vendored target (Abseil, protobuf, opentelemetry-cpp) via_esp_opentelemetry_apply_int_overrideincmake/protobuf_setup.cmake:Root cause
ESP-IDF v6 platform headers (
assert.h,sys/time.h,pthread.h, and others) guard feature blocks with#if CONFIG_*Kconfig macros. When a Kconfig option is disabled, ESP-IDF omits the#define CONFIG_X 0line fromsdkconfig.hentirely — the symbol is simply absent. This means#if CONFIG_Xexpands to#if(undefined identifier), which GCC treats as#if 0but emits a-Wundefdiagnostic.Abseil and protobuf include several ESP-IDF platform headers indirectly (through
<time.h>,<pthread.h>, etc.). Under-Werror=allthese-Wundefhits become hard errors, breaking the build.This did not occur in ESP-IDF v5 because v5 always emitted
#define CONFIG_X 0for disabled Kconfig symbols insdkconfig.h.Proposed fix
ESP-IDF should restore the
#define CONFIG_X 0pattern for disabled Kconfig symbols, or guard its own platform headers with#ifdef CONFIG_Xrather than#if CONFIG_X.What we delete once fixed
-Wno-undefentry in_esp_opentelemetry_apply_int_overrideincmake/protobuf_setup.cmake