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 <BLEDevice.h> 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.
This commit is contained in:
Sybren A. Stüvel 2026-03-15 21:13:19 +01:00
parent 382a5403b7
commit d8e838fe4d
3 changed files with 23 additions and 2 deletions

View file

@ -2,7 +2,13 @@
#include <Mesh.h>
#include "MyMesh.h"
#include <helpers/BLELogInterface.h>
#if BLE_PACKET_LOGGING
#if defined(NRF52_PLATFORM) || defined(ESP32)
#include <helpers/BLELogInterface.h>
#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;

View file

@ -2,7 +2,13 @@
#include <Mesh.h>
#include "MyMesh.h"
#include <helpers/BLELogInterface.h>
#if BLE_PACKET_LOGGING
#if defined(NRF52_PLATFORM) || defined(ESP32)
#include <helpers/BLELogInterface.h>
#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;

View file

@ -26,6 +26,15 @@ build_src_filter = ${rp2040_base.build_src_filter}
+<PicoWBoard.cpp>
+<../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 <BLEDevice.h> 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