PlatformIO Community

Problem with libraries AsyncTCP.h

Although I do everything for the library installation in the platformio ide, I can’t get any results. I’ve done a few basic projects before, but somehow I couldn’t show the #include <AsyncTCP.h> library. I would be glad if you help

Screenshot_2

My main.c :

#include <AsyncTCP.h>
#include <WiFi.h>
const char* wifi_network_ssid = "UniqueID";
const char* wifi_network_password =  "xxxxx";
 
const char *soft_ap_ssid = "MyESP32AP";
const char *soft_ap_password = "testpassword";
  
AsyncWebServer server(80);
  
void setup() {
 
  Serial.begin(115200);
  WiFi.mode(WIFI_MODE_APSTA);
 
  WiFi.softAP(soft_ap_ssid, NULL);
  IPAddress local_IP(10,0,35,1);
  IPAddress gateway(10,0,35,1);
  IPAddress subnet(255,255,0,0);
  Serial.print("Setting soft-AP configuration ... ");
  Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");
 
  WiFi.begin(wifi_network_ssid, wifi_network_password);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi..");
  }
 
  Serial.print("ESP32 IP as soft AP: ");
  Serial.println(WiFi.softAPIP());
 
  Serial.print("ESP32 IP on the WiFi network: ");
  Serial.println(WiFi.localIP());
  
  server.on("", HTTP_GET, [](AsyncWebServerRequest * request) {
 
    if (ON_STA_FILTER(request)) {
      request->send(200, "text/plain", "Hello, ESP using as a Station");
      return;
 
    } else if (ON_AP_FILTER(request)) {
      request->send(200, "text/plain", "Hello, ESP using as an Access Point");
      return;
    }
 
    request->send(200, "text/plain", "Hello from undefined");
  });
 
  server.begin();
   
}
 
void loop() {}

You haven’t shown your platformio.ini? Did you add the library to lib_deps?

Yeah, I included many libraries in it
Screenshot_4

…You’re tripple including AsyncTCP and Arduino-ESP32, which is very wrong. A library should only be included from one source, and an entire Arduino core can’t just be included as a ‘library’.

The reason why library inclusion of all of that is failing is because you’re using the custom platform https://github.com/deneyapkart/deneyapkart-platformio-core. Libraries include in their manifest, library.json, which platforms they’re compatible with. EPS32 chips belong to the official espressif32 platform. You’re usung deneyap as a platform, which doesn’t match what the library wants to see

Especially since it sets libCompatMode to 2, meaning strict.

You can use lib_compat_mode = off in the platformio.ini to disable this compatibility check.

[env:deneyapkart]
platform = deneyap
framework = arduino
board = deneyapkart
build_flags = -DCORE_DEBUG_LEVEL=5 
              -DBOARD_HAS_PSRAM 
              -mfix-esp32-psram-cache-issue  
monitor_speed = 115200
; disable compatibility checks
lib_compat_mode = off
lib_ldf_mode = deep
lib_deps =
   me-no-dev/AsyncTCP@^1.1.1

Overall, I don’t see the sense in using a dedicated platform for a single board that is exactly an ESP32, for which support already exists regularily, but okay.

1 Like

I’m just getting started with these. Thanks for your help but I got same error again
Screenshot_5
second image : 9w925q0.png

Yeah because of the library’s library.json overriding the global compat setting.

CONFIGURATION: https://docs.platformio.org/page/boards/deneyap/deneyapkart.html
PLATFORM: Deneyap (1.0.0+sha.e231d85) (git+https://github.com/deneyapkart/deneyapkart-platformio-core.git) > Deneyap Kart
HARDWARE: ESP32 240MHz, 8.52MB 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.30000.201119 (3.0.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep, Compatibility ~ off
Platform incompatible library /home/max/temp/.pio/libdeps/deneyapkart/AsyncTCP
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Found 28 compatible libraries
Scanning dependencies...
No dependencies

Seems like a fork is necessary.

1 Like

Using

[env:deneyapkart]
platform = deneyap
framework = arduino
board = deneyapkart
build_flags = -DCORE_DEBUG_LEVEL=5 
              -DBOARD_HAS_PSRAM 
              -mfix-esp32-psram-cache-issue  
monitor_speed = 115200
; disable compatibility checks
lib_compat_mode = off
lib_ldf_mode = deep
lib_deps =
   https://github.com/maxgerhardt/AsyncTCP.git

works with

#include <Arduino.h>
#include <AsyncTCP.h>

void setup(){}
void loop(){}
Linking .pio/build/deneyapkart/firmware.elf
Retrieving maximum program size .pio/build/deneyapkart/firmware.elf
Checking size .pio/build/deneyapkart/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.2% (used 13416 bytes from 8937472 bytes)
Flash: [=         ]   8.5% (used 266606 bytes from 3145728 bytes)
Building .pio/build/deneyapkart/firmware.bin
esptool.py v3.0
========================= [SUCCESS] Took 4.15 seconds =========================

My fork removes the compatiblity check. (https://github.com/maxgerhardt/AsyncTCP/commit/8672812c9865e0fcd01f025f3333d34341acc600)

Thank you for your help, I am grateful. Library issue solved So As I understand, Do I need to do this for every library that I will include? like wifi.h?

Screenshot_7

https://www.hizliresim.com/ocwoirg

@maxgerhardt … thanks for this. The inputs have helped me in solving problem with AsyncMqttClient_Generic library which was giving LwIP.h not found error.