Header package files not installing for ESP32 Camera project

I have been trying to build the ESP32 camera from the Prusa ESP32 camera project.
For some reason the “.h” packages are not installing. I have tried this on VSC with Platform IO on both Linux Mint and Windows machines. I am not sure where I am going wrong. Some of the libraries that are in the project are not in PlatformIO and I pulled them off Github. I have a separate project that I dropped the libraries in directly from Github and tried it that way with no luck.

Does anyone have any suggestions to get me pointed in the right direction ?

Thank you!

/*
   This code is adapted for the ESP32-CAM board Ai Thinker version

   It's neccesary install support for ESP32 board to the arduino IDE. In the board manager we need add next link
   https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
   Then we can install "ESP32 by Espressif Systems" board in the board manager.
   ESP32 lib version: 2.0.16 (ESP-IDF v4.4.7) by Espressif Systems

   This project uses other libraries. It is necessary to install them in the arduino IDE.
   - Library         - License  - Version - Link
   - ESPAsyncWebSrv  - LGPL 2.1 - 1.2.7   - https://github.com/dvarrel/ESPAsyncWebSrv
   - AsyncTCP        - LGPL 3.0 - 1.1.4   - https://github.com/dvarrel/ESPAsyncTCP
   - ArduinoJson     - MIT      - 7.0.4   - https://github.com/bblanchon/ArduinoJson
   - ArduinoUniqueID - MIT      - 1.3.0   - https://github.com/ricaun/ArduinoUniqueID
   - ESP32           - LGPL 2.1 - 2.0.16  - https://github.com/espressif/arduino-esp32

   Board configuration in the arduino IDE 2.3.2
   Tools -> Board -> ESP32 Arduino -> AI Thinker ESP32
   Tools -> Flash frequency -> 80MHz
   Tools -> Flash Mode -> DIO
   Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)

   When flashing the firmware to a new, empty ESP32-CAM device for the first time, it is necessary to use the 'Erase' function.
   This can be found under 'Tools' -> 'Erase all Flash Before Sketch Upload' -> 'Enable'.
   After the initial firmware upload to the MCU, it is possible to disable this option.
   If you do not disable this option, your camera configuration will continue to be erased from the flash memory
   after uploading new firmware from the Arduino IDE.

   Here is partitions table
     # Name,   Type, SubType, Offset,  Size, Flags
     nvs,      data, nvs,     0x9000,  0x5000,
     otadata,  data, ota,     0xe000,  0x2000,
     app0,     app,  ota_0,   0x10000, 0x1E0000,
     app1,     app,  ota_1,   0x1F0000,0x1E0000,
     spiffs,   data, spiffs,  0x3D0000,0x20000,
     coredump, data, coredump,0x3F0000,0x10000,

   Project: ESP32 PrusaConnect Camera
   Developed for: Prusa Research, prusa3d.com
   Author: Miroslav Pivovarsky
   e-mail: miroslav.pivovarsky@gmail.com
*/

/* includes */
#include <WiFi.h>
#include "Arduino.h"
#include <esp_task_wdt.h>
#include <ESPmDNS.h>
#include <esp_wifi.h>
#include "esp32-hal-cpu.h"

#include "server.h"
#include "cfg.h"
#include "var.h"
#include "mcu_cfg.h"
#include "system.h"
#include "micro_sd.h"
#include "log.h"
#include "connect.h"
#include "wifi_mngt.h"
#include "stream.h"
#include "serial_cfg.h"




Compiling .pio/build/esp32cam/src/main.cpp.o
src/main.cpp:52:10: fatal error: server.h: No such file or directory

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

 #include "server.h"
          ^~~~~~~~~~
compilation terminated.
Archiving .pio/build/esp32cam/libd19/libAsyncTCP.a
*** [.pio/build/esp32cam/src/main.cpp.o] Error 1
Indexing .pio/build/esp32cam/libd19/libAsyncTCP.a
======================================================================== [FAILED] Took 1.88 seconds ========================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

I found the file with the .h files. I just need to figure out where to place the file full of the .h files in the project and how to link that folder in the project. I am assuming a line needs to be added in plaformio.ini folder to point it to the .h files.

thanks for the help!

It is not clear what do you mean by “the Prusa ESP32 camera project”.
After googling, I suppose you mean GitHub - prusa3d/Prusa-Firmware-ESP32-Cam: Firmware for ESP32 Cam modules to be used in Prusa Connect ?

Here is the platformio.ini which should contain all necessary dependencies.

[env:esp32cam]
platform = espressif32 @ ^6.7.0
board = esp32cam
framework = arduino
lib_deps = 
  https://github.com/dvarrel/AsyncTCP @ ^1.1.4
  https://github.com/dvarrel/ESPAsyncWebSrv @ ^1.2.7
  bblanchon/ArduinoJson @ ^7.0.4
  https://github.com/ricaun/ArduinoUniqueID @ ^1.3.0

Unfortunately there are a bunch of errors while compiling the project. This list is extremously long so I’m not going to post it here.

It seems to me that the project contains a lot of non valid C++ code (which works fine in ArduinoIDE)

What do you mean by installing “.h” packages?
“.h” are header files, not packages.

Header files used by the project are usually placed into the include folder.

It is still unclear to me what you mean by this.
Which header file are you referring to?

Thank you sivar2311 for taking the time to point me in the right direction as I struggle with this. I have not been able to successfully use outside libraries or .h files. If everything is in the PIO library I am good to go.

The error I am trying to get past is #include “server.h” not found which is at the top of these

#include "server.h"
#include "cfg.h"
#include "var.h"
#include "mcu_cfg.h"
#include "system.h"
#include "micro_sd.h"
#include "log.h"
#include "connect.h"
#include "wifi_mngt.h"
#include "stream.h"
#include "serial_cfg.h"

It is the list of /h header files that I have in the include folder that are not supporting the build of the project.

I have placed the server.h file (along with the rest of the .h files) in the include folder.

I ran across some other topics that discussed using symlink and build flags and thought this may be the way to solve it, which I have not succeeded yet

my current platform.ini file

[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
build_flags = 
    -I /home/jake/Documents/PlatformIO/Projects/ESP32_CAM/include/Prusa-Firmware-ESP32-Cam
lib_deps = 
    symlink:/home/jake/Documents/PlatformIO/Projects/ESP32_CAM/include/Prusa-Firmware-ESP32-Cam

I get a much shorter error now

Executing task: platformio run

Processing esp32cam (platform: espressif32; board: esp32cam; framework: arduino)

Library Manager: Installing symlink:/home/jake/Documents/PlatformIO/Projects/ESP32_CAM/include/Prusa-Firmware-ESP32-Cam
VCSBaseException: VCS: Unknown repository type symlink:/home/jake/Documents/PlatformIO/Projects/ESP32_CAM/include/Prusa-Firmware-ESP32-Cam

  • The terminal process “platformio ‘run’” terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

Ah, you mean the PIO registry.

I just followed the links in the description which were named for the dependencies. ArduinoJson is definitely included in the PlatformIO registry. I’m not sure about the others (and I was too lazy to search for them). The GitHub links work anyway :slight_smile:

All files for this project belong in the src directory!
You do not have to copy anything!

The folder and file structure should look like this:

.
├── include
├── lib
├── src
│   ├── Camera_cfg.h
│   ├── camera.cpp
│   ├── camera.h
│   ├── Certificate_ota.h
│   ├── Certificate.h
│   ├── cfg.cpp
│   ├── cfg.h
│   ├── connect.cpp
│   ├── connect.h
│   ├── ESP32_PrusaConnectCam.ino
│   ├── jquery.h
│   ├── log.cpp
│   ├── log.h
│   ├── mcu_cfg.h
│   ├── micro_sd.cpp
│   ├── micro_sd.h
│   ├── serial_cfg.cpp
│   ├── serial_cfg.h
│   ├── server.cpp
│   ├── server.h
│   ├── stream.cpp
│   ├── stream.h
│   ├── sys_led.cpp
│   ├── sys_led.h
│   ├── system.cpp
│   ├── system.h
│   ├── var.cpp
│   ├── var.h
│   ├── WebPage_Icons.h
│   ├── WebPage.h
│   ├── wifi_mngt.cpp
│   └── wifi_mngt.h
├── test
└── platformio.ini

This is wrong in several ways. Please remove that.
See the folder and file structure above.

The problem with this project is not that any header files are missing. Changes have to be made in various places so that it is a valid C/C++ project which PlatformIO can then compile.

The ArduinoIDE handles some things differently.

Please try to compile this project with the ArduinoIDE.

I think you are most likely to get help if you ask the maintainers of this project.
See Issues · prusa3d/Prusa-Firmware-ESP32-Cam · GitHub