u8g2 icon indicating copy to clipboard operation
u8g2 copied to clipboard

ESP-IDF 5.x: u8g2 build fails due to required header files not in include path

Open chrbecke opened this issue 1 year ago • 1 comments

When trying to build u8g2 under ESP-IDF 5.3.2 I get the following compile error (with IDF 4.x it worked).

---- snip ---- In file included from C:/Users/.../components/u8g2/csrc/u8g2_esp32_hal.c:10: C:/Users/.../components/u8g2/csrc/u8g2_esp32_hal.h:12:10: fatal error: driver/gpio.h: No such file or directory 12 | #include "driver/gpio.h" | ^~~~~~~~~~~~~~~ compilation terminated. ---- snip ----

--> With ESP-IDF 5.x Espressif has changed the build system and now requires to explicityly specify component dependencies.

I could fix it for me by adding REQUIRES "driver" to idf_component_register in the top level CMakeLists.txt file.

if(COMMAND idf_component_register) idf_component_register(SRCS "${COMPONENT_SRCS}" INCLUDE_DIRS csrc REQUIRES "driver" return() endif()

See also https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/release-5.x/5.0/build-system.html

Thanks for the great work on u8g2!

chrbecke avatar Apr 24 '25 08:04 chrbecke

Difficult for my, because I only support official Arduino ports for u8g2.

u8g2_esp32_hal.c has nither been written nor is supported by me.

Maybe a ESP32 Arduino port will work better...

olikraus avatar May 02 '25 19:05 olikraus