You might have encountered this ESPAsyncWebServer error when dealing with the ESPAsyncWebServer library.
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp: In function 'bool getMD5(uint8_t*, uint16_t, char*)':
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp:74:3: error: 'mbedtls_md5_starts_ret' was not declared in this scope; did you mean 'mbedtls_md5_starts'?
74 | mbedtls_md5_starts_ret(&_ctx);
| ^~~~~~~~~~~~~~~~~~~~~~
| mbedtls_md5_starts
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp:75:3: error: 'mbedtls_md5_update_ret' was not declared in this scope; did you mean 'mbedtls_md5_update'?
75 | mbedtls_md5_update_ret(&_ctx, data, len);
| ^~~~~~~~~~~~~~~~~~~~~~
| mbedtls_md5_update
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp:76:3: error: 'mbedtls_md5_finish_ret' was not declared in this scope; did you mean 'mbedtls_md5_finish'?
76 | mbedtls_md5_finish_ret(&_ctx, _buf);
| ^~~~~~~~~~~~~~~~~~~~~~
| mbedtls_md5_finish
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncEventSource.cpp: In member function 'void AsyncEventSourceClient::_queueMessage(AsyncEventSourceMessage*)':
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncEventSource.cpp:188:7: error: 'ets_printf' was not declared in this scope; did you mean 'vswprintf'?
188 | ets_printf("ERROR: Too many messages queued\n");
| ^~~~~~~~~~
| vswprintf
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp: In member function 'void AsyncWebSocketClient::_queueMessage(AsyncWebSocketMessage*)':
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp:551:7: error: 'ets_printf' was not declared in this scope; did you mean 'vswprintf'?
551 | ets_printf("ERROR: Too many messages queued\n");
| ^~~~~~~~~~
| vswprintf
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp: In member function 'IPAddress AsyncWebSocketClient::remoteIP()':
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp:832:28: error: call of overloaded 'IPAddress(unsigned int)' is ambiguous
832 | return IPAddress(0U);
| ^
In file included from C:\Users\...\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0\cores\esp32/Arduino.h:196,
from C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp:21:
C:\Users\...\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0\cores\esp32/IPAddress.h:115:3: note: candidate: 'IPAddress::IPAddress(const ip_addr_t*)'
115 | IPAddress(const ip_addr_t *addr);
| ^~~~~~~~~
C:\Users\...\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0\cores\esp32/IPAddress.h:73:3: note: candidate: 'IPAddress::IPAddress(const IPAddress&)'
73 | IPAddress(const IPAddress &address);
| ^~~~~~~~~
C:\Users\...\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0\cores\esp32/IPAddress.h:72:3: note: candidate: 'IPAddress::IPAddress(const char*)'
72 | IPAddress(const char *address);
| ^~~~~~~~~
C:\Users\...\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0\cores\esp32/IPAddress.h:69:3: note: candidate: 'IPAddress::IPAddress(const uint8_t*)'
69 | IPAddress(const uint8_t *address);
| ^~~~~~~~~
C:\Users\...\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0\cores\esp32/IPAddress.h:67:3: note: candidate: 'IPAddress::IPAddress(uint32_t)'
67 | IPAddress(uint32_t address);
| ^~~~~~~~~
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp: In constructor 'AsyncWebSocketResponse::AsyncWebSocketResponse(const String&, AsyncWebSocket*)':
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp:1262:3: error: 'mbedtls_sha1_starts_ret' was not declared in this scope; did you mean 'mbedtls_sha1_starts'?
1262 | mbedtls_sha1_starts_ret(&ctx);
| ^~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha1_starts
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp:1263:3: error: 'mbedtls_sha1_update_ret' was not declared in this scope; did you mean 'mbedtls_sha1_update'?
1263 | mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
| ^~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha1_update
C:\Users\...\Documents\Arduino\libraries\ESPAsyncWebServer\src\AsyncWebSocket.cpp:1264:3: error: 'mbedtls_sha1_finish_ret' was not declared in this scope; did you mean 'mbedtls_sha1_finish'?
1264 | mbedtls_sha1_finish_ret(&ctx, hash);
| ^~~~~~~~~~~~~~~~~~~~~~~
| mbedtls_sha1_finish
Error during build: exit status 1
IntelliSense configuration updated. To manually rebuild your IntelliSense configuration run "Ctrl+Alt+I"
[Error] Verifying sketch 'TestServer.ino': Exit with code=1
The error is caused by some ESP32 functions used in the library being deprecated. If you have updated the esp32 boards that might trigger this problem. Otherwise, some automatic updates may have triggered these issues as well.
The library developers should ideally fix these issues. Until then, you could manually modify the files in the library to get your program compiled.
Step 1: Go to the Arduino IDE libraries folder
You can do this using the file path specified in the compiler output pane.
It should be similar to:
C:\Users\<USERNAME>\Documents\Arduino\libraries\ESPAsyncWebServer\
Otherwise, follow these steps.
1. Go to preferences
2. Go to this address
3. Locate the library folder
You can copy and paste the location into the file explorer to get to the location.
Then browse to the libraries folder and locate the ESPAsyncWebServer library files
Usually in:
C:\Users\<USERNAME>\Documents\Arduino\libraries\ESPAsyncWebServer\src
The most file you should edit is in the src folder
2. Make the changes to ESPAsyncWebServer files
You can either use the following files (Modified by us) or make the changes manually by yourself.
Using the modified files
These are the modified files of library version 1.0.5. If you have another version, do the changes yourself instead. Extract these files to the src folder of your ESPAsyncWebServer library folder.
Please backup all the files before replacing them with these modified files
Making the changes yourself
Alternatively, you can make the compiler’s suggested changes manually in library files to get it to work. Though this might not be the best solution, it will work.
mbedtls_md5_starts_… errors
For example, for this error:
C:\Users...\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp:74:3: error: 'mbedtls_md5_starts_ret' was not declared in this scope; did you mean 'mbedtls_md5_starts'?
- Open C:\Users…\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp in a text editor
- Go to line 74
- Change error: ‘mbedtls_md5_starts_ret’ to ‘mbedtls_md5_starts’
Do this for all compiler suggestions.
The following lines should be changed.
in: Arduino\libraries\ESPAsyncWebServer\src\WebAuthentication.cpp
#include <mbedtls/md5.h> // Add this include at the top //Changes in this function bool getMD5(uint8_t* data, uint16_t len, char* output) { mbedtls_md5_context _ctx; unsigned char _buf[16]; mbedtls_md5_init(&_ctx); mbedtls_md5_starts(&_ctx); // Change this line mbedtls_md5_update(&_ctx, data, len); // Change this line mbedtls_md5_finish(&_ctx, _buf); // Change this line mbedtls_md5_free(&_ctx); for (int i = 0; i < 16; i++) { sprintf(output + (i * 2), "%02x", _buf[i]); } return true; }
In all code files where ets_printf() exists.
Use the find tool to locate all ets_printf and change to printf. (Eg: in AsyncWebSocket.cpp and AsyncEventSource.cpp)
printf("ERROR: Too many messages queued\n"); // Change this line (Example)
Final thoughts
Replacing deprecated functions with still available functions will fix this ESPAsyncWebServer error as explained in this article.
However, if you reinstall or update the library, it will go back to its original state and might stop compiling again.
Hopefully, this will be fixed in future library updates. Stay in touch for updates until then!
Leave a Reply