Skip to content

ESP-IDF & Arduino-ESP32 & WebServer: fatal error: http_parser.h: No such file or directory #5293

Closed
@andreaskuster

Description

@andreaskuster

Hardware:

Board: ESP32 Dev Module
ESP-IDF Version: master@1d7068e4b (matching commit of last sync between arduino-esp32 and esp-idf)
Arduino-ESP32 Version: master
IDE name: IDF component
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Ubuntu

Description:

Compilation fails with the error below, after including the web server stack (i.e. WiFi.h, WebServer.h)
`

Sketch

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>

const char* ssid = "........";
const char* password = "........";

WebServer server(80);

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(".");
  }

  if (MDNS.begin("esp32")) {
    Serial.println("MDNS responder started");
  }

  server.begin();
}

void loop(void) {
  server.handleClient();
  delay(2);
}

Debug Messages:

...
[ 86%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_check.c.obj
[ 86%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_gc.c.obj
[ 86%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_hydrogen.c.obj
[ 86%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_nucleus.c.obj
[ 86%] Linking C static library libspiffs.a
[ 86%] Built target __idf_spiffs
Scanning dependencies of target __idf_WIFIMANAGER-ESP32
[ 86%] Building CXX object esp-idf/WIFIMANAGER-ESP32/CMakeFiles/__idf_WIFIMANAGER-ESP32.dir/WiFiManager.cpp.obj
In file included from /home/andreas/CLionProjects/ESP32-WebCam/components/arduino/libraries/WebServer/src/WebServer.h:30,
                 from /home/andreas/CLionProjects/ESP32-WebCam/components/WIFIMANAGER-ESP32/WiFiManager.h:21,
                 from /home/andreas/CLionProjects/ESP32-WebCam/components/WIFIMANAGER-ESP32/WiFiManager.cpp:13:
/home/andreas/CLionProjects/ESP32-WebCam/components/arduino/libraries/WebServer/src/HTTP_Method.h:4:10: fatal error: http_parser.h: No such file or directory
 #include "http_parser.h"
          ^~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [esp-idf/WIFIMANAGER-ESP32/CMakeFiles/__idf_WIFIMANAGER-ESP32.dir/build.make:82: esp-idf/WIFIMANAGER-ESP32/CMakeFiles/__idf_WIFIMANAGER-ESP32.dir/WiFiManager.cpp.obj] Error 1
make[2]: *** [CMakeFiles/Makefile2:5144: esp-idf/WIFIMANAGER-ESP32/CMakeFiles/__idf_WIFIMANAGER-ESP32.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2465: CMakeFiles/esp32-webcam.elf.dir/rule] Error 2
make: *** [Makefile:365: esp32-webcam.elf] Error 2

Solution

The webserver seems to depend on the the nghttp library ( http_parser.h ). Adding this requirement to CMakeLists.txt solves the problem. I will open a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions