ayushsharma82 / ElegantOTA

OTA updates made slick and simple for everyone!
https://elegantota.pro
GNU Affero General Public License v3.0
634 stars 116 forks source link

ESP32 cannot compile: NetworkInterface.h: No such file or directory #220

Closed Yourry closed 3 weeks ago

Yourry commented 1 month ago

Hello, I am a visual studio code user and I can't compile and install elegantOTA on my esp32 c3 mini. I followed the tutorial: https://docs.elegantota.pro/installation/

Here is my platorfmio.ini file :

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:lolin_c3_mini]
platform    = espressif32
board       = lolin_c3_mini
framework   = arduino

lib_compat_mode = strict

The main.cpp is the tutorial code, I just changed the wifi data.

When compiling I get the following error:

Executing task in folder ESP32_MQTT_iEM2055_ElegantOTA: C:\Users\Dim\.platformio\penv\Scripts\platformio.exe run --environment lolin_c3_mini 

Processing lolin_c3_mini (platform: espressif32; board: lolin_c3_mini; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Library Manager: Installing mathieucarbou/ESPAsyncWebServer @ ^3.1.1
Unpacking  [####################################]  100%
Library Manager: ESPAsyncWebServer@3.2.4 has been installed!
Library Manager: Installing mathieucarbou/AsyncTCP @ ^3.2.5 
Unpacking  [####################################]  100%
Library Manager: AsyncTCP@3.2.5 has been installed!
Library Manager: Installing esphome/ESPAsyncTCP-esphome @ ^2.0.0
Unpacking  [####################################]  100%
Library Manager: ESPAsyncTCP-esphome@2.0.0 has been installed!
Library Manager: Installing khoih-prog/AsyncTCP_RP2040W @ ^1.2.0
Unpacking  [####################################]  100%
Library Manager: AsyncTCP_RP2040W@1.2.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/lolin_c3_mini.html
PLATFORM: Espressif 32 (2023.12.10+sha.5426a6e) > WEMOS LOLIN C3 Mini
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, 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.0.0
 - tool-cmake @ 3.21.3
 - tool-esptoolpy @ 1.40700.0+dev4 (4.7.0)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-mklittlefs @ 3.2.0
 - tool-mkspiffs @ 2.230.0 (2.30)
 - tool-ninja @ 1.9.0
 - tool-riscv32-esp-elf-gdb @ 11.2.0+20220823
 - tool-xtensa-esp-elf-gdb @ 11.2.0+20230208
 - toolchain-riscv32-esp @ 12.2.0+20230208
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ strict
Found 26 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ElegantOTA @ 3.1.5
|-- WebServer @ 2.0.0
|-- WiFi @ 2.0.0
Building in release mode
Compiling .pio\build\lolin_c3_mini\lib4a5\AsyncTCP\AsyncTCP.cpp.o
Archiving .pio\build\lolin_c3_mini\lib8e7\libWebServer.a
Compiling .pio\build\lolin_c3_mini\lib57b\ESPAsyncWebServer\AsyncWebSocket.cpp.o
Compiling .pio\build\lolin_c3_mini\lib57b\ESPAsyncWebServer\WebResponses.cpp.o
Compiling .pio\build\lolin_c3_mini\lib57b\ESPAsyncWebServer\WebServer.cpp.o
Compiling .pio\build\lolin_c3_mini\lib9bf\LittleFS\LittleFS.cpp.o
Compiling .pio\build\lolin_c3_mini\lib8b4\Update\HttpsOTAUpdate.cpp.o
Compiling .pio\build\lolin_c3_mini\lib8b4\Update\Updater.cpp.o
.pio/libdeps/lolin_c3_mini/AsyncTCP/src/AsyncTCP.cpp:39:10: fatal error: NetworkInterface.h: No such file or directory

**************************************************************************
* Looking for NetworkInterface.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:NetworkInterface.h"
* Web  > https://registry.platformio.org/search?q=header:NetworkInterface.h
*
**************************************************************************

   39 | #include <NetworkInterface.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio\build\lolin_c3_mini\lib43f\ElegantOTA-3.1.5\ElegantOTA.cpp.o
*** [.pio\build\lolin_c3_mini\lib4a5\AsyncTCP\AsyncTCP.cpp.o] Error 1
.pio/libdeps/lolin_c3_mini/ESPAsyncWebServer/src/AsyncWebSocket.cpp:32:14: fatal error: SHA1Builder.h: No such file or directory

*********************************************************************
* Looking for SHA1Builder.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:SHA1Builder.h"
* Web  > https://registry.platformio.org/search?q=header:SHA1Builder.h
*
*********************************************************************

   32 |     #include <SHA1Builder.h>
      |              ^~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\lolin_c3_mini\lib57b\ESPAsyncWebServer\AsyncWebSocket.cpp.o] Error 1
================================================================================== [FAILED] Took 33.99 seconds ==================================================================================

Do you have any idea? Did I do something wrong? Thank you very much

mathieucarbou commented 1 month ago

Hello @Yourry : I am the maintainer of these libs (async and ESPAsyncWebServer). I will check later today.

I had similar issues in another project with not there. I so not remember how I resolved it from memory - will check. This happened after a refactor from Arduino.

For the sha include I will check also.

Also maybe try with lib_ldf_mode = chain in your platformio config.

And fyi, you can use Arduino 3 now...

See: https://github.com/pioarduino/platform-espressif32?tab=readme-ov-file#stable-version

mathieucarbou commented 1 month ago

@Yourry : can you please provide your platformio config file ?

mathieucarbou commented 1 month ago

I am unable to reproduce. Here is my platformio file:

[env:lolin_c3_mini]
platform    = espressif32
board       = lolin_c3_mini
framework   = arduino
lib_compat_mode = strict
lib_deps =
  mathieucarbou/AsyncTCP @ 3.2.5
  mathieucarbou/ESPAsyncWebServer @ 3.2.4
  ayushsharma82/ElegantOTA @ 3.1.4
build_flags = -D ELEGANTOTA_USE_ASYNC_WEBSERVER=1

But like I said, it depends also on your includes in your app... The app I am testing with has these headers in the main class:

#include <ESPAsyncWebServer.h>
#include <MycilaSystem.h>
#include <WiFi.h>
Yourry commented 1 month ago

Already thanks for the quick answers! For the main.cpp code I use the one from the tutorial:

/*
  -----------------------
  ElegantOTA - Demo Example
  -----------------------

  Skill Level: Beginner

  This example provides with a bare minimal app with ElegantOTA functionality.

  Github: https://github.com/ayushsharma82/ElegantOTA
  WiKi: https://docs.elegantota.pro

  Works with both ESP8266 & ESP32

  -------------------------------

  Upgrade to ElegantOTA Pro: https://elegantota.pro

*/

#if defined(ESP8266)
  #include <ESP8266WiFi.h>
  #include <WiFiClient.h>
  #include <ESP8266WebServer.h>
#elif defined(ESP32)
  #include <WiFi.h>
  #include <WiFiClient.h>
  #include <WebServer.h>
#endif

#include <ElegantOTA.h>

const char* ssid = "MON_SSID";
const char* password = "MON_PASS";

#if defined(ESP8266)
  ESP8266WebServer server(80);
#elif defined(ESP32)
  WebServer server(80);
#endif

void setup(void) {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  server.on("/", []() {
    server.send(200, "text/plain", "Hi! This is ElegantOTA Demo.");
  });

  ElegantOTA.begin(&server);    // Start ElegantOTA
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
  server.handleClient();
  ElegantOTA.loop();
}

And the platformio (I copied yours and I have the error):

[env:lolin_c3_mini]
platform    = espressif32
board       = lolin_c3_mini
framework   = arduino
lib_compat_mode = strict
lib_deps =
  mathieucarbou/AsyncTCP @ 3.2.5
  mathieucarbou/ESPAsyncWebServer @ 3.2.4
  ayushsharma82/ElegantOTA @ 3.1.4
build_flags = -D ELEGANTOTA_USE_ASYNC_WEBSERVER=1

There is nothing else, the project is blank. However when I replace the line: platform = espressif32 With this one: platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip

The compilation error disappears and everything is ok. Unfortunately the upload does not work because of the lack of the ESP32 C3 firmware but that is another topic. I will test with another ESP32. Thanks

mathieucarbou commented 1 month ago

👍 You should switch to Arduino 3 anyway...

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been stalled for 5 days with no activity.