Help seeked: Toolchain broken after attempting to add a new board

Hi Community

I’m desperately trying to compile my code for adafruit_qtpy_esp32s2 which perfectly worked for more than 12 month until yesterday. Yesterday, I temporarily added a new board (xiao esp32c3) to platformio.ini.
Since then (and after removing the newly added xiao config again) I cannot compile my code anymore. I even created a new windows user and reinstalled platformio but the result stayed the same.

I get gross errors like those for WiFi.h and Update.h:

.pio/libdeps/adafruit_qtpy_esp32s2/WebSockets/src/WebSockets.h:205:10: fatal error: WiFi.h: No such file or directory
and
.pio/libdeps/adafruit_qtpy_esp32s2/ArduinoOTA/src/InternalStorageESP.cpp:24:10: fatal error: Update.h: No such file or director

There are also errors in my ADC routines where I use ESP32 specific structs.

But those files are on my disk: C:\Users\me\.platformio\packages\framework-arduinoespressif32\libraries\WiFi\src\WiFi.h
and C:\Users\me\.platformio\packages\framework-arduinoespressif32\libraries\Update\src\Update.h

So far I never took much notice of the dependency graph. Should there be more?
Also, most probably, the framework-arduinoespressif32 version is highter than I had it (I hardly updated libs before because they were just working).

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/adafruit_qtpy_esp32s2.html
PLATFORM: Espressif 32 (6.2.0+sha.da13338) > Adafruit QT Py ESP32-S2
HARDWARE: ESP32S2 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20008.0 (2.0.8) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
 - toolchain-xtensa-esp32s2 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 41 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ArduinoJson @ 6.21.2
|-- ArduinoOTA @ 1.0.9
|-- WebSockets @ 2.3.7
|   |-- SPI @ 2.0.0
|-- Adafruit NeoPixel @ 1.10.4
|-- SPI @ 2.0.0
Building in release mode

My config looks like this ans is unchanged:

[env:adafruit_qtpy_esp32s2]
platform = espressif32
board = adafruit_qtpy_esp32s2
framework = arduino
test_framework = unity
lib_deps = 
	bblanchon/ArduinoJson@^6.19.4
	jandrassy/ArduinoOTA@^1.0.9
	links2004/WebSockets@^2.3.7
extra_scripts = 
	pre:scripts/preBuild.py
	post:scripts/postBuild.py
build_src_filter = 
	${env.build_src_filter}
	-<driver>
	+<driver/arduino>
	-<main_*.cpp>
build_flags = 
	${env.build_flags}
	-I lib/hsm
	-I lib/base64/src
	-I src/utils
	-I src/Extensions
#upload_port = COM13

Any help much appreciated. And thanks for reading!
TinkerPhu.

So it’s not detecting the WiFi library as a subdependency?

The first defense would be to try different lib_ldf_mode values, like deep+.

Thank you @maxgerhardt for your generously quick answer and pointing me in the right direction.

The solution seams that I have to add all the required framework Libs to platformio.ini.
This might be obvious for the community (:person_facepalming:) and I obviously missed it :face_with_open_eyes_and_hand_over_mouth:. The point is that I did not list all those arduinoespressif32 libraries before and it was just compiling/linking perfectly. (As you can see in my first message, there was still the SPI found by the toolchain without having it declared in platformio.ini).

I got it compiling and linking by adding all the needed framework libs to platformio.ini.
I seam to have initiated some update processes yesterday. Unconsciously and definitely unintended. Unfortunately I have no idea, what versions of libs I used before the incident.
So I guess, the only way is forward. I am now screening my code for all implicitly used libraries and add them with new versions in the platformio.ini). But I have crashes at several points in the code (due to some unfitting versions, I assume).

By the way, actually lib_ldf_mode = chain+ made it worse meaning that in the above dependency graph, even SPI was missing.
So I wonder whether this is actually a bug or a feature.

Currently my config looks like this, followed by the dependency graph:

[env:adafruit_qtpy_esp32s2]
platform = espressif32
board = adafruit_qtpy_esp32s2
framework = arduino
test_framework = unity
;lib_ldf_mode = chain+
lib_deps = 
	bblanchon/ArduinoJson@^6.19.4
	jandrassy/ArduinoOTA@^1.0.9
	links2004/WebSockets@^2.4.1
    adafruit/Adafruit NeoPixel @ ^1.11.0
    Update @ ^2.0.0
    WiFi @ ^2.0.0
    WiFiClientSecure @ ^2.0.0
    Preferences @ ^2.0.0
extra_scripts = 
	pre:scripts/preBuild.py
	post:scripts/postBuild.py
build_src_filter = 
	${env.build_src_filter}
	-<driver>
	+<driver/arduino>
	-<main_*.cpp>
build_flags = 
	${env.build_flags}
	-I lib/hsm
	-I lib/base64/src
	-I src/utils
	-I src/Extensions
#upload_port = COM13

Dependency Graph:

Dependency Graph
|-- ArduinoJson @ 6.21.2
|-- ArduinoOTA @ 1.0.9
|   |-- Update @ 2.0.0
|-- WebSockets @ 2.4.1
|   |-- Ethernet @ 2.0.0
|   |   |-- WiFi @ 2.0.0
|   |-- SPI @ 2.0.0
|   |-- WiFi @ 2.0.0
|   |-- WiFiClientSecure @ 2.0.0
|   |   |-- WiFi @ 2.0.0
|-- Adafruit NeoPixel @ 1.11.0
|-- Update @ 2.0.0
|-- WiFi @ 2.0.0
|-- WiFiClientSecure @ 2.0.0
|   |-- WiFi @ 2.0.0
|-- Preferences @ 2.0.0
|-- SPI @ 2.0.0
|-- WebServer @ 2.0.0
|   |-- WiFi @ 2.0.0
|   |-- FS @ 2.0.0
|-- base64 @ 1.2.1
Building in release mode

Thanks and best regards!