From d8e838fe4d1c4e92948b024045a50936fb7d1cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Sun, 15 Mar 2026 21:13:19 +0100 Subject: [PATCH] Fix build on Pico W Use `lib_ldf_mode=chain+` so the LDF evaluates preprocessor conditions when scanning for library dependencies. Without this, the LDF (in default 'deep' mode) ignores it to find #include inside the #ifdef ESP32 block in esp32/BLELogInterface.h, pulling in the Arduino-Pico BLE library. That library only compiles correctly when PIO_FRAMEWORK_ARDUINO_ENABLE_BLUETOOTH is set (which enables the required BTstack defines), so without that flag the build fails. chain+ prevents this by honouring the #ifdef ESP32 guard. --- examples/simple_repeater/main.cpp | 8 +++++++- examples/simple_room_server/main.cpp | 8 +++++++- variants/rpi_picow/platformio.ini | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 6170fdd9..ae6f99c2 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -2,7 +2,13 @@ #include #include "MyMesh.h" -#include +#if BLE_PACKET_LOGGING + #if defined(NRF52_PLATFORM) || defined(ESP32) + #include + #else + #error "BLE_PACKET_LOGGING is not supported on this platform (only ESP32 and nRF52)" + #endif +#endif #if MESH_PACKET_LOGGING && BLE_PACKET_LOGGING && (defined(NRF52_PLATFORM) || defined(ESP32)) static BLELogInterface ble_log; diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 94438649..13a16ecb 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -2,7 +2,13 @@ #include #include "MyMesh.h" -#include +#if BLE_PACKET_LOGGING + #if defined(NRF52_PLATFORM) || defined(ESP32) + #include + #else + #error "BLE_PACKET_LOGGING is not supported on this platform (only ESP32 and nRF52)" + #endif +#endif #if MESH_PACKET_LOGGING && BLE_PACKET_LOGGING && (defined(NRF52_PLATFORM) || defined(ESP32)) static BLELogInterface ble_log; diff --git a/variants/rpi_picow/platformio.ini b/variants/rpi_picow/platformio.ini index ec5cdb83..d77920c5 100644 --- a/variants/rpi_picow/platformio.ini +++ b/variants/rpi_picow/platformio.ini @@ -26,6 +26,15 @@ build_src_filter = ${rp2040_base.build_src_filter} + +<../variants/rpi_picow> lib_deps = ${rp2040_base.lib_deps} +; Use chain+ so the LDF evaluates preprocessor conditions when scanning for +; library dependencies. Without this, the LDF (in default 'deep' mode) ignores +; #ifdef guards and follows all #include directives unconditionally. That causes +; it to find #include inside the #ifdef ESP32 block in +; esp32/BLELogInterface.h, pulling in the Arduino-Pico BLE library. That +; library only compiles correctly when PIO_FRAMEWORK_ARDUINO_ENABLE_BLUETOOTH is +; set (which enables the required BTstack defines), so without that flag the +; build fails. chain+ prevents this by honouring the #ifdef ESP32 guard. +lib_ldf_mode = chain+ [env:PicoW_repeater] extends = rpi_picow