Repository navigation
fix(build): compile cleanly as a standalone ESP-IDF component - #2511
Conversation
The IDF Component Manager applies a hardcoded DEFAULT_EXCLUDE list to the fetched git tree, which strips any directory called build/ via the pattern '**/build/**/*'. This drops src/fl/build/, where every unity-entry .cpp file lives. Without those entries the fetched component has zero compilable sources, FastLED's CMakeLists.txt GLOB returns nothing, and IDF registers FastLED as a CONFIG_ONLY component -- producing undefined references for every FastLED symbol at link time. files.include patterns run last in the filter pipeline and re-add paths after the default exclude removes them, so a single include rule restores the unity entries without disabling any default filtering.
file(GLOB) does not walk subdirectories and CMake does not treat `**` as a recursive wildcard, so the previous src/**/*.cpp pattern matched nothing. With no sources, idf_component_register registered FastLED as a CONFIG_ONLY component -- IDF skipped compilation and every FastLED symbol came out as an undefined reference at link time. Switch to GLOB_RECURSE so the unity-entry .cpp files under src/fl/build/ (and any future top-level src/ .cpp files) are picked up reliably.
The audio module uses driver/i2s_std.h (esp_driver_i2s), the gpio_isr_rx driver uses driver/mcpwm_cap.h (esp_driver_mcpwm), and the asio/http server module uses esp_http_server.h. None of these were in REQUIRES, so when FastLED is registered as a standalone ESP-IDF managed component their headers were out of scope at compile time.
📝 WalkthroughWalkthroughFastLED's ESP-IDF component build configuration is updated to support additional hardware interfaces. The CMake build now recursively discovers source files and declares new framework dependencies. The component packaging configuration is updated to preserve generated build artifacts during distribution. ChangesESP-IDF Component Configuration
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks! |
Three independent build-system bugs prevent FastLED from compiling when consumed
as a managed ESP-IDF component.
1. Unity-entry sources stripped from the fetched component
The IDF Component Manager filters the fetched git tree through a hardcoded
DEFAULT_EXCLUDElist inidf_component_tools/file_tools.py, which contains**/build/**/*. That glob matchessrc/fl/build/-- the directory holdingevery unity-build entry
.cppfile -- and silently drops it from thedistributed tree.
Fix: add a
files.includerule toidf_component.yml. Manifestincludepatterns run last in the filter pipeline and re-add paths after the defaults
strip them, so a single rule restores the unity entries without disabling any
other default filtering.
2. CMakeLists glob did not collect any sources
file(GLOB FastLED_SRCS "src/**/*.cpp")matched zero files because CMake'sfile(GLOB)is not recursive and**is not a wildcard. With 1. abovefixed, the unity entries are present on disk but the glob still found
nothing, so
idf_component_registerregistered FastLED asCONFIG_ONLYandIDF skipped compilation entirely -- producing undefined references for
every FastLED symbol at link time.
Fix: switch to
file(GLOB_RECURSE ... "src/*.cpp").3. Missing
REQUIRESfor I2S, MCPWM, and HTTP server componentsFastLED's audio module includes
<driver/i2s_std.h>(needsesp_driver_i2s), thegpio_isr_rxdriver includes<driver/mcpwm_cap.h>(needs
esp_driver_mcpwm), and thefl/stl/asio/http/servermoduleincludes
<esp_http_server.h>(needsesp_http_server). None of thesecomponents were listed in
REQUIRES, so when FastLED was compiled in theIDF component scope their headers were out of scope and the unity TUs hit
fatal include errors.
Fix: add the three components to
REQUIRES.Summary by CodeRabbit