Solved compile error ESP32 platform ESP32 V3.0
When installing the ESP32 V3.0.0 new some function are removed and or changed changing the following will resolve compile error with the libraries major version V2 and V3.
Changed in Arduino\libraries\ESPAsyncWebServer\src\WebAuthentic
at line 75,76,77
#ifdef ESP_ARDUINO_VERSION_MAJOR
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
// Code for version 3.x
mbedtls_md5_init(&_ctx);
mbedtls_md5_starts(&_ctx);
mbedtls_md5_update(&_ctx, data, len);
mbedtls_md5_finish(&_ctx, _buf);
#else
// Code for version 2.x
#ifdef ESP32
mbedtls_md5_init(&_ctx);
mbedtls_md5_starts_ret(&_ctx);
mbedtls_md5_update_ret(&_ctx, data, len);
mbedtls_md5_finish_ret(&_ctx, _buf);
#else
MD5Init(&_ctx);
MD5Update(&_ctx, data, len);
MD5Final(_buf, &_ctx);
#endif
#endif
#endif
in AsyncEventSource.cpp changed at line 189 ets_printf --> log_e for V3
and in AsyncWebSocket.cpp changed at line 549 ets_printf --> log_e for V3
#ifdef ESP_ARDUINO_VERSION_MAJOR
#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0)
// Code for version 3.x
log_e("ERROR: Too many messages queued\n");
#else
// Code for version 2.x
ets_printf("ERROR: Too many messages queued\n");
#endif
#endif
For some clarification, this is regarding the latest release of the arduino core for esp32 from espressif: Arduino Release v3.0.0 based on ESP-IDF v5.1.4 The previous release was based on ESP-IDF v4.4.7. So the underlying framework has changed significantly between these updates.
I also just attempted to use the latest release and encountered some errors which @ednieuw is addressing above.
For reference, the errors appear as follows for me:
/home/hans/projects/Arduino/libraries/ESPAsyncWebServer/src/WebAuthentication.cpp: In function 'bool getMD5(uint8_t*, uint16_t, char*)':
/home/hans/projects/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
/home/hans/projects/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
/home/hans/projects/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
/home/hans/projects/Arduino/libraries/ESPAsyncWebServer/src/AsyncEventSource.cpp: In member function 'void AsyncEventSourceClient::_queueMessage(AsyncEventSourceMessage*)':
/home/hans/projects/Arduino/libraries/ESPAsyncWebServer/src/AsyncEventSource.cpp:189:7: error: 'ets_printf' was not declared in this scope; did you mean 'vswprintf'?
189 | ets_printf("ERROR: Too many messages queued\n");
| ^~~~~~~~~~
| vswprintf
/home/hans/projects/Arduino/libraries/ESPAsyncWebServer/src/AsyncWebSocket.cpp: In member function 'void AsyncWebSocketClient::_queueMessage(AsyncWebSocketMessage*)':
/home/hans/projects/Arduino/libraries/ESPAsyncWebServer/src/AsyncWebSocket.cpp:549:7: error: 'ets_printf' was not declared in this scope; did you mean 'vswprintf'?
549 | ets_printf("ERROR: Too many messages queued\n");
| ^~~~~~~~~~
| vswprintf
This fork is more up to date and supports Arduijno 3: https://github.com/mathieucarbou/ESPAsyncWebServer