fix(ci): fix math / st7123touch / meshtastic example builds on ESP-IDF v6 - #759
Conversation
…F v6
IDF v6 ships GCC 15.2 and compiles its own components with -Wall -Wextra -Werror,
so warnings the older toolchain tolerated now fail the build:
- math: the example applied -Wdouble-promotion PROJECT-WIDE (add_compile_options
before project()), which also compiled it into ESP-IDF, whose esp32 code
(esp_hw_support/port/esp32/rtc_clk.c) trips it under the new GCC and fails its
-Werror build. Scope the flag to the example's own translation units via
target_compile_options(${COMPONENT_LIB} PRIVATE -Wdouble-promotion) so the
float-only check is kept without touching IDF.
- st7123touch / meshtastic: -Werror=missing-field-initializers flagged the
std::function config members with no default member initializer
(St7123Touch::Config::write/read, MeshtasticNode::Config::transmit) when a
designated-initializer aggregate omits them. Give them a default {nullptr},
matching their sibling members (e.g. meshtastic on_text{nullptr}); this fixes
the warning for every caller, not just these examples.
Verified on IDF v6.0.1 (GCC 15.2): math (esp32) and st7123touch (esp32s3) build
clean. meshtastic (esp32s3) had transmit as its sole missing-initializer error
(same fix pattern) and pulls in large BSP/lvgl submodules, so it was not rebuilt.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Fixes ESP-IDF v6 (GCC 15.2, -Wall -Wextra -Werror) example build failures by scoping a warning flag to the example component and providing default initializers for omitted std::function/callable config members.
Changes:
- Scope
-Wdouble-promotionto the math example component viatarget_compile_options()instead of applying it project-wide. - Add default
{nullptr}initializers for config callables inst7123touchandmeshtasticto avoid-Wmissing-field-initializersbecoming an error under-Werror. - Document why the warning flag must not be applied globally in the math example’s top-level
CMakeLists.txt.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| components/st7123touch/include/st7123touch.hpp | Adds default initialization for config callable members to avoid missing-field-initializers errors. |
| components/meshtastic/include/meshtastic.hpp | Adds default initialization for the transmit callback to avoid missing-field-initializers errors. |
| components/math/example/main/CMakeLists.txt | Applies -Wdouble-promotion only to the example component target. |
| components/math/example/CMakeLists.txt | Removes project-wide warning flag application and documents the rationale. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
✅Static analysis result - no issues found! ✅ |
…moved to private ESP-IDF v6 ships mbedtls 4.x, which moved the low-level AES API out of the public <mbedtls/aes.h> (now gone) into <mbedtls/private/aes.h> as PSA Crypto became the public interface. meshtastic_crypto.cpp uses mbedtls_aes_crypt_ctr for the Meshtastic AES-256-CTR packet cipher, so it failed with "mbedtls/aes.h: No such file or directory" on v6. Select the header by MBEDTLS_VERSION_MAJOR (from the public <mbedtls/build_info.h>) so it keeps building on mbedtls 3.x (IDF v5) and builds on 4.x (IDF v6); the mbedtls_aes_* functions themselves are unchanged. This was the second v6 break in this example (after the transmit initializer); meshtastic (esp32s3) now builds clean on IDF v6.0.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Follow-up: meshtastic had a second v6 break beyond the
meshtastic (esp32s3) now builds clean on IDF v6.0.1 — so all three examples in this PR are verified end-to-end. |
After the CI bump to ESP-IDF v6 (#751), three example builds fail. v6 ships GCC 15.2 and compiles IDF’s own components with
-Wall -Wextra -Werror, so warnings the older toolchain tolerated now break the build.Fixes
esp32): the example applied-Wdouble-promotionproject-wide (add_compile_optionsbeforeproject()), so it was also compiled into ESP-IDF — whose esp32 code (esp_hw_support/port/esp32/rtc_clk.c) trips it under the new GCC and fails IDF’s-Werrorbuild. Scope the flag to the example’s own translation units viatarget_compile_options(${COMPONENT_LIB} PRIVATE -Wdouble-promotion)inmain/CMakeLists.txt, keeping the float-only check without touching IDF. (The example is deliberately float-pure — all0.05fliterals — so it still passes.)esp32s3) / meshtastic (esp32s3):-Werror=missing-field-initializersflagged thestd::functionConfigmembers with no default member initializer (St7123Touch::Config::write/read,MeshtasticNode::Config::transmit) when a designated-initializer aggregate omits them. Give them a default{nullptr}, matching their sibling members (e.g. meshtastic’son_text{nullptr}) — fixing it for every caller, not just these examples.Verification (IDF v6.0.1 / GCC 15.2, local)
math(esp32) → Project build completest7123touch(esp32s3) → Project build completemeshtastic(esp32s3):transmitwas its sole missing-initializer error (identical pattern to st7123touch, which builds clean); it pulls in the large BSP/lvgl submodules, so it was not rebuilt locally.🤖 Generated with Claude Code