ayushsharma82 / ElegantOTA

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

Error compiling Async Demo in PlatformIO #152

Closed sbarabe closed 11 months ago

sbarabe commented 11 months ago

Hi, I'm trying to compile Async Demo on PlatformIO but I get these error:

c:/users/sbara/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libf7f\libESP Async WebServer.a(WebAuthentication.cpp.o):(.literal._ZL6getMD5PhtPc+0x4): undefined reference to `mbedtls_md5_starts'
c:/users/sbara/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\libf7f\libESP Async WebServer.a(WebAuthentication.cpp.o): in function `getMD5(unsigned char*, unsigned short, char*)':
C:\Users\sbara\OneDrive\Documents\PlatformIO\Projects\OTA_RemoteXY_test/.pio/libdeps/esp32dev/ESP Async WebServer/src/WebAuthentication.cpp:73: undefined reference to `mbedtls_md5_starts'

My ini files is:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = 
    ayushsharma82/ElegantOTA@^3.1.0
    me-no-dev/AsyncTCP@^1.1.1
    me-no-dev/ESP Async WebServer@^1.2.3
build_flags=-DELEGANTOTA_USE_ASYNC_WEBSERVER=1

What I'm I doing wrong ?

mathieucarbou commented 11 months ago

Maybe try to fix the expressif32 version. Example:

[env]
framework = arduino
platform = espressif32@6.4.0
lib_compat_mode = strict
lib_ldf_mode = deep+
sbarabe commented 11 months ago

Hi, thanks for the reply. I'm quite new to PlatformIO and some setup are eluding me yet !

Ok I've tried this ini:

[env:esp32dev]
platform = espressif32@6.4.0
lib_compat_mode = strict
lib_ldf_mode = deep+
board = esp32dev
framework = arduino
lib_deps = 
    ayushsharma82/ElegantOTA@^3.1.0
    me-no-dev/AsyncTCP@^1.1.1
    me-no-dev/ESP Async WebServer@^1.2.3
build_flags=-DELEGANTOTA_USE_ASYNC_WEBSERVER=1

Now I've this error instead:

src/main.cpp:35:10: fatal error: ElegantOTA.h: No such file or directory

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

 #include <ElegantOTA.h>
          ^~~~~~~~~~~~~~
compilation terminated.

I've reinstall the ElegantOTA lib, but it remains the same...

If I comment the "strict" and "deep+" lines in the ini file, I got the first error as describe initially...

mathieucarbou commented 11 months ago

Did you check that the dependency downloads correctly ?

Maybe try to fetch from github directly:

lib_deps = 
    https://github.com/ayushsharma82/ElegantOTA@^3.1.0
sbarabe commented 11 months ago

Sorry, I'm really noob at this ! Can't get it from github:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Library Manager: Installing git+https://github.com/ayushsharma82/ElegantOTA @ ^3.1.0
UserSideException: Please install Git client from https://git-scm.com/downloads

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

I don't know what to install and where, is it a Visual Code extension ?

sbarabe commented 11 months ago

So I try the Elegant Demo (not Async) with my original ini file and it compiles OK.

The conflict is in the Async Demo, maybe it's flag related or in regard with AsyncTCP and/or ESPAsyncwebserver ????

For the flag in PlatformIO, is it the correct way:

build_flags=-DELEGANTOTA_USE_ASYNC_WEBSERVER=1

mathieucarbou commented 11 months ago

For the flag in PlatformIO, is it the correct way:

build_flags=-DELEGANTOTA_USE_ASYNC_WEBSERVER=1

yes.

But your error is quite descriptive: Please install Git client from https://git-scm.com/downloads

Make sure you have a proper dev. env. in place before even thinking of using platformio...

The project works fine (I am a contributor) and CI build pass.

sbarabe commented 11 months ago

Thank you Mathieu, I couldn't find a way yet with Async type OTA, but it works fine with the "sync" version. So I'll stick with that for now.

HowardsPlayPen commented 11 months ago

Just today I have been looking to compile ElegantOTA in async mode and had the above unresolved externals (eg undefined reference to `mbedtls_md5_starts ).

To fix the above issue I found mention (https://github.com/me-no-dev/ESPAsyncWebServer/issues/1141) to include the following in platform.ini lib_deps = https://github.com/me-no-dev/ESPAsyncWebServer.git

(as the code was updated in the repository but no release made to include it). This fixed the error for me (I obviously removed the reference to the downloaded version of "me-no-dev/ESP Async WebServer@^1.2.3" )

As a side node - I also had worked through the cryptic error of error: 'HTTP_DELETE' conflicts with a previous declaration XX(0, DELETE, DELETE)

and found that I hadnt updated the build_flags in platform.ini as described above to: build_flags=-DELEGANTOTA_USE_ASYNC_WEBSERVER=1

I mention this only because the issue was not obvious and I had to search a while to find the build_flags update was needed.

Note: initially I had espressif32 version 6.3.0 installed - so I updated it to 6.4.0, as mentioned above and that did not solve the unresolved external issue (although it might have helped stop subsequent issues showing up - hence me mentioning it)

sbarabe commented 11 months ago

@HowardsPlayPen

To fix the above issue I found mention (me-no-dev/ESPAsyncWebServer#1141) to include the following in platform.ini lib_deps = https://github.com/me-no-dev/ESPAsyncWebServer.git

(as the code was updated in the repository but no release made to include it). This fixed the error for me (I obviously removed the reference to the downloaded version of "me-no-dev/ESP Async WebServer@^1.2.3" )

I've replace lib_deps to the ESPAsyncWebServer git like you popose and it works fine !

Thanks for the help !