ESP32 build trying to use Raspberry Pi Files

I’ve got several ESP32 projects that build with no problem. I created a new project selecting board type “Espressif ESP32 Dev Module” and framework Arduino. The new project was successfully created. Then I copied all the files from src in an existing ESP32 project to src in the new project.
I also copied the platformio.ini file.

[env:esp32dev]
platform = espressif32 @ ~3.5.0
board = esp32dev
framework = arduino
lib_extra_dirs = ~/Documents/Arduino/libraries
monitor_speed = 115200
lib_deps = 
	ESP Async WebServer
	bblanchon/ArduinoJson @ ^6.17.3
	ottowinter/ArduinoJson-esphomelib@^6.15.2
;	marian-craciunescu/ESP32Ping@^1.7
extra_scripts = pre:pre_compile.py
upload_port = COM6
monitor_port = COM6
; upload_protocol = espota
; upload_port = 192.168.0.125

When I do a build I get an error because it appears to be trying to use Raspberry Pi files:

Processing esp32dev (platform: espressif32 @ ~3.5.0; board: esp32dev; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
pre_compile.py running
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (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.10006.210326 (1.0.6) 
 - tool-esptoolpy @ 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP Async WebServer @ 3.0.6
|-- ArduinoJson @ 6.21.6
|-- ArduinoJson-esphomelib @ 6.15.2
|-- FS @ 1.0
|-- SPIFFS @ 1.0
|-- Async TCP @ 3.1.4
|-- Update @ 1.0
|-- WiFi @ 1.0
|-- EEPROM @ 1.0.3
|-- ESPmDNS @ 1.0
|-- ArduinoOTA @ 1.0
Building in release mode
Compiling .pio\build\esp32dev\src\BuildTime.cpp.o
Compiling .pio\build\esp32dev\libcbb\AsyncTCP_RP2040W\AsyncPrinter.cpp.o
Compiling .pio\build\esp32dev\libcbb\AsyncTCP_RP2040W\AsyncTCP_RP2040W.cpp.o
Compiling .pio\build\esp32dev\libcbb\AsyncTCP_RP2040W\AsyncTCP_RP2040W_buffer.cpp.o
Compiling .pio\build\esp32dev\libcbb\AsyncTCP_RP2040W\SyncClient.cpp.o
In file included from .pio\libdeps\esp32dev\AsyncTCP_RP2040W\src\AsyncPrinter.h:51:0,
                 from .pio\libdeps\esp32dev\AsyncTCP_RP2040W\src\AsyncPrinter.cpp:51:
.pio\libdeps\esp32dev\AsyncTCP_RP2040W\src\AsyncTCP_RP2040W.h:73:4: error: #error For RASPBERRY_PI_PICO_W board using CYW43439WiFi only
   #error For RASPBERRY_PI_PICO_W board using CYW43439 WiFi only
    ^

Then several more errors of the same type, i.e. from AsyncTCP_RP2040W`files.

I’ve never seen this before in several years of using PlatformIO. If you know how to fix it, any help would be greatly appreciated.

[Edit: I did a ‘clean’. All my source files built okay, but I still get the above error]

I asked AI how to fix it.

First AI suggestion was to add this to libdeps in platformio.ini

me-no-dev/AsyncTCP @ ^1.1.1

That didn’t help. I still get the errors.

Second AI suggestion was to add this to platformio.ini

lib_ignore = AsyncTCP_RP2040W

That worked.

I’d still like to know why I’ve got at least 3 other projects, with essentially the same platformio.ini file, all of which use ESP Async WebServer and work fine without being told to ignore that library.

Why does this new project have to be told to ignore it?

This appears to be a PlatformIO library dependency resolution issue. The build is selecting AsyncTCP_RP2040W, which targets Raspberry Pi Pico W rather than ESP32. Different ESPAsyncWebServer versions or forks may have different dependency declarations. Try adding lib_compat_mode = strict and lib_ldf_mode = chain to platformio.ini. Also, temporarily remove lib_extra_dirs to rule out conflicting Arduino libraries. Check the installed ESPAsyncWebServer library’s library.json for its dependency declarations. The lib_ignore workaround is valid, but identifying why PlatformIO selects the wrong TCP library would be a better long-term fix.

Yes, I’d like to know why. However I have 3 existing ESP32 projects using the same ESP32 board, the arduino framework and essentially the same platformio.ino as far as the ESPAsyncWebServer libdeps, and the use of lib_extra_dirs is concerned. All of those projects were created at least one year ago and don’t suffer from this problem.

Other than starting by creating a new project yesterday, the new project should be identical to the working project that I copied the src files and platformio.ini from. I’m wondering if there is something to do with creating a new project first that messed up something to cause this problem.

I was hoping someone seeing my posts might have seen the same problem and know what the root cause is.

Your lib_debs is wrong. The ESP Asyc Webswerver line should be esp32async/ESPAsyncWebServer@^3.12.1. Note that there are also no spaces.

Thank you for spotting that. IDK why I got that wrong in the first place years ago. All four projects (the other 3 work without having to add lib ignore for the pi library) contain the same error, but only this new project had the build problem.