Error linking a specific library

Hi everyone,

on my pio project I want to add a “OTA Drive” library, but when I add it from “Libraries” then many errors come out like as:

Immagine 2023-05-14 133914

 *  Executing task: C:\Users\Utente\.platformio\penv\Scripts\platformio.exe run --environment upload-usb 

Processing upload-usb (platform: espressif32; framework: arduino; board: esp32-s3-devkitc-1)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (6.2.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.20008.0 (2.0.8)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 39 compatible libraries
Scanning dependencies...
Dependency Graph
|-- OTAdrive @ 1.1.11
|-- client
|-- lora
|-- config
|-- util
Building in release mode
Compiling .pio\build\upload-usb\src\main.cpp.o
Archiving .pio\build\upload-usb\libff9\libWiFi.a
Compiling .pio\build\upload-usb\libe14\OTAdrive\FlashUpdater.cpp.o
Compiling .pio\build\upload-usb\libe14\OTAdrive\otadrive_esp.cpp.o
Compiling .pio\build\upload-usb\libe14\OTAdrive\otadrive_misc.cpp.o
Compiling .pio\build\upload-usb\libe14\OTAdrive\tinyHTTP.cpp.o
src/main.cpp:5:10: fatal error: RTClib.h: No such file or directory

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

 #include <RTClib.h>
          ^~~~~~~~~~
compilation terminated.
Compiling .pio\build\upload-usb\lib6d3\util\utils.cpp.o
Compiling .pio\build\upload-usb\libf50\SPI\SPI.cpp.o
*** [.pio\build\upload-usb\src\main.cpp.o] Error 1
In file included from .pio/libdeps/upload-usb/OTAdrive/src/otadrive_misc.cpp:1:
.pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.h:5:10: fatal error: FS.h: No such file or directory

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

 #include <FS.h>
          ^~~~~~
compilation terminated.
In file included from .pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.cpp:1:
.pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.h:5:10: fatal error: FS.h: No such file or directory

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

 #include <FS.h>
          ^~~~~~
compilation terminated.
*** [.pio\build\upload-usb\libe14\OTAdrive\otadrive_esp.cpp.o] Error 1
*** [.pio\build\upload-usb\libe14\OTAdrive\otadrive_misc.cpp.o] Error 1
.pio/libdeps/upload-usb/OTAdrive/src/tinyHTTP.cpp:8:10: fatal error: HTTPClient.h: No such file or directory

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

 #include <HTTPClient.h>
          ^~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\upload-usb\libe14\OTAdrive\tinyHTTP.cpp.o] Error 1
In file included from .pio/libdeps/upload-usb/OTAdrive/src/FlashUpdater.cpp:2:
.pio/libdeps/upload-usb/OTAdrive/src/FlashUpdater.h:9:10: fatal error: Update.h: No such file or directory

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

 #include <Update.h>
          ^~~~~~~~~~
compilation terminated.
*** [.pio\build\upload-usb\libe14\OTAdrive\FlashUpdater.cpp.o] Error 1
In file included from lib/util/utils.cpp:1:
lib/util/utils.h:2:10: fatal error: RTClib.h: No such file or directory

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

 #include <RTClib.h>
          ^~~~~~~~~~
compilation terminated.
*** [.pio\build\upload-usb\lib6d3\util\utils.cpp.o] Error 1
==================================================================================================================== [FAILED] Took 8.77 seconds ====================================================================================================================

Environment    Status    Duration
-------------  --------  ------------
upload-usb     FAILED    00:00:08.775
=============================================================================================================== 1 failed, 0 succeeded in 00:00:08.775 ===============================================================================================================
 *  The terminal process "C:\Users\Utente\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'upload-usb'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

What could be the problem?

Full platformio.ini?

[env]

platform = espressif32

framework = arduino

board = esp32-s3-devkitc-1

lib_deps =

knolleary/PubSubClient@^2.8

vshymanskyy/TinyGSM@^0.11.5

plerup/EspSoftwareSerial

adafruit/RTClib@^1.14.1

nickgammon/Regexp@^0.1.0

bblanchon/ArduinoJson@^6.18.5

openslab-osu/EthernetLarge@^2.0.0

openslab-osu/SSLClient@^1.6.11

xreef/EByte LoRa E220 library@^1.0.3

amcewen/HttpClient@^2.2.0

Update

Wire

SPI

WiFiClientSecure

lib_ldf_mode = chain+

upload_speed = 921600

build_flags =

-DACTIVATE_SOFTWARE_SERIAL

-DFREQUENCY_868

-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

test_port = "rfc2217://10.0.0.12:4000?ign_set_control"

[env:upload-usb]

upload_port = COM22

monitor_port = COM22

test_port = COM22

[env:upload-rfc2217]

upload_protocol = custom

upload_command = esptool.py --chip esp32s2 --port "rfc2217://10.0.0.12:4000?ign_set_control" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 C:\Users\Utente\.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/bin/bootloader_dio_80m.bin 0x8000 .pio/build/upload-rfc2217/partitions.bin 0xe000 C:\Users\Utente\.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/upload-rfc2217/firmware.bin

monitor_port = "rfc2217://10.0.0.12:4000?ign_set_control"

lib_deps =

vshymanskyy/StreamDebugger@^1.0.1

otadrive/OTAdrive@^1.1.11

[env:upload-ota]

upload_protocol = espota

upload_port = abiot-gateway.local

monitor_port = rfc2217://10.0.0.12:4000?ign_set_control

lib_deps =

vshymanskyy/StreamDebugger@^1.0.1

otadrive/OTAdrive@^1.1.11

No. You redefine lib_deps in this environment, throwing out all the libraries you defined in [env].

You must follow the documentation in regards to interpolation

https://docs.platformio.org/en/latest/projectconf/interpolation.html

So, all sub-environments have to do

lib_deps =
  ${env.lib_deps}
  vshymanskyy/StreamDebugger@^1.0.1
  otadrive/OTAdrive@^1.1.11

to preserve the additional libraries and add onto it.

I cleaned up the file and left only the main “env” and now it’s like this.

[env]
platform = espressif32
framework = arduino
board = esp32-s3-devkitc-1
lib_deps =
knolleary/PubSubClient@^2.8
vshymanskyy/TinyGSM@^0.11.5
plerup/EspSoftwareSerial
adafruit/RTClib@^1.14.1
nickgammon/Regexp@^0.1.0
bblanchon/ArduinoJson@^6.18.5
openslab-osu/EthernetLarge@^2.0.0
openslab-osu/SSLClient@^1.6.11
xreef/EByte LoRa E220 library@^1.0.3
amcewen/HttpClient@^2.2.0
Update
Wire
SPI
WiFiClientSecure
otadrive/OTAdrive@^1.1.11
lib_ldf_mode = chain+
upload_speed = 921600
build_flags =
-DACTIVATE_SOFTWARE_SERIAL
-DFREQUENCY_868
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

[env:upload-usb]
upload_port = COM22
monitor_port = COM22
test_port = COM22




And my monitor now:

Processing upload-usb (platform: espressif32; framework: arduino; board: esp32-s3-devkitc-1)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-s3-devkitc-1.html
PLATFORM: Espressif 32 (6.2.0) > Espressif ESP32-S3-DevKitC-1-N8 (8 MB QD, No PSRAM)
HARDWARE: ESP32S3 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (esp-builtin) On-board (esp-builtin) External (cmsis-dap, esp-bridge, 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.20008.0 (2.0.8)
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
 - toolchain-xtensa-esp32s3 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 50 compatible libraries
Scanning dependencies...
Dependency Graph
|-- PubSubClient @ 2.8.0
|-- TinyGSM @ 0.11.5
|-- EspSoftwareSerial @ 8.0.3      
|-- RTClib @ 1.14.2
|-- Regexp @ 0.1.0
|-- ArduinoJson @ 6.21.2
|-- EthernetLarge @ 2.0.0
|-- SSLClient @ 1.6.11
|-- EByte LoRa E220 library @ 1.0.8
|-- HttpClient @ 2.2.0
|-- Update @ 2.0.0
|-- Wire @ 2.0.0
|-- SPI @ 2.0.0
|-- WiFiClientSecure @ 2.0.0
|-- OTAdrive @ 1.1.11
|-- FS @ 2.0.0
|-- HTTPUpdate @ 2.0.0
|-- WiFi @ 2.0.0
|-- SPIFFS @ 2.0.0
|-- client
|-- lora
|-- config
|-- util
Building in release mode
Compiling .pio\build\upload-usb\src\main.cpp.o
In file included from src/main.cpp:4:
.pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.h:64:2: warning: #warning "This version of the OTAdrive library uses the MD5 matcher mechanism instead of the version code mechanism to decide download new firmware or not. If you don't like it, call OTAdrive.useMD5Matcher(false)" [-Wcpp]
 #warning "This version of the OTAdrive library uses the MD5 matcher mechanism instead of the version code mechanism to decide download new firmware or not. If you don't like it, call OTAdrive.useMD5Matcher(false)"
  ^~~~~~~
Archiving .pio\build\upload-usb\lib77d\libEthernetLarge.a
In file included from .pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.h:13,
                 from src/main.cpp:4:
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:56:48: error: 'HTTPClient' was not declared in this scope
 using HTTPUpdateRequestCB = std::function<void(HTTPClient*)>;
                                                ^~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:56:48: note: suggested alternative: 'HttpClient'
 using HTTPUpdateRequestCB = std::function<void(HTTPClient*)>;
                                                ^~~~~~~~~~
                                                HttpClient
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:56:60: error: template argument 1 is invalid
 using HTTPUpdateRequestCB = std::function<void(HTTPClient*)>;
                                                            ^
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:77:29: error: 'followRedirects_t' has not been declared
     void setFollowRedirects(followRedirects_t follow)
                             ^~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:88:106: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                          ^~~~~~~~~~~~~~~~~~~
In file included from .pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.h:13,
                 from src/main.cpp:4:
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:91:67: error: 'HTTPUpdateRequestCB' has not been declared
                                const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                   ^~~~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:93:112: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                ^~~~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:95:32: error: 'HTTPClient' has not been declared
     t_httpUpdate_return update(HTTPClient& httpClient,
                                ^~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:97:32: error: 'HTTPUpdateRequestCB' has not been declared
                                HTTPUpdateRequestCB requestCB = NULL);
                                ^~~~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:99:38: error: 'HTTPClient' has not been declared
     t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                      ^~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:99:97: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                 ^~~~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:111:38: error: 'HTTPClient' has not been declared
     t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false, HTTPUpdateRequestCB requestCB = NULL);
                                      ^~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:111:107: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false, HTTPUpdateRequestCB requestCB = NULL);
                                                                                                           ^~~~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:125:5: error: 'followRedirects_t' does not name a type
     followRedirects_t _followRedirects;
     ^~~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:88:138: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                          ^~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:91:99: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
                                const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                   ^~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:93:144: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                                ^~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:97:64: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
                                HTTPUpdateRequestCB requestCB = NULL);
                                                                ^~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:99:129: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                 ^~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:111:139: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false, HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                           ^~~~
In file included from .pio/libdeps/upload-usb/OTAdrive/src/otadrive_esp.h:13,
                 from src/main.cpp:4:
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h: In member function 'void HTTPUpdate::setFollowRedirects(int)':
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:79:9: error: '_followRedirects' was not declared in this scope
         _followRedirects = follow;
         ^~~~~~~~~~~~~~~~
C:/Users/Utente/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:79:9: note: suggested alternative: 'setFollowRedirects'
         _followRedirects = follow;
         ^~~~~~~~~~~~~~~~
         setFollowRedirects
Compiling .pio\build\upload-usb\lib82a\SSLClient\SSLClient.cpp.o
Compiling .pio\build\upload-usb\lib82a\SSLClient\SSLClientParameters.cpp.o
Compiling .pio\build\upload-usb\lib82a\SSLClient\TLS12_only_profile.c.o
Compiling .pio\build\upload-usb\lib82a\SSLClient\bearssl\src\aead\ccm.c.o
Compiling .pio\build\upload-usb\lib82a\SSLClient\bearssl\src\aead\eax.c.o
Compiling .pio\build\upload-usb\lib82a\SSLClient\bearssl\src\aead\gcm.c.o
*** [.pio\build\upload-usb\src\main.cpp.o] Error 1
.pio/libdeps/upload-usb/SSLClient/src/SSLClientParameters.cpp: In function 'void std::__throw_length_error(const char*)':
.pio/libdeps/upload-usb/SSLClient/src/SSLClientParameters.cpp:5:67: warning: 'noreturn' function does return
     void __attribute__((weak)) __throw_length_error(char const*) {}
                                                                   ^
==================================================================================================================== [FAILED] Took 28.81 seconds ====================================================================================================================
 *  The terminal process "C:\Users\Utente\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'upload-usb'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

Looks like a library you included breaks the build in HTTP library by also having a HTTPClient.h or similiar (upper/lowercasing) named tha declares a HttpClient class, overshadowing the built-in HTTPClient class.

and by the looks of it, it’s this one. Why do you need that library specifically and can’t use the one built-into the Arduino-ESP32 core, called HTTPClient?

That bookcase was stuck in me from a previous test.
Now I removed it and everything works.

Thank you