After changing framework: collect2.exe: error: ld returned 1 exit status

Changed a pio project configuration from
framework = arduino
to
framework = espidf
and back.

Now I can#t compile the project any more:

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 32 (6.0.1) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) 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.20006.221224 (2.0.6)
  • tool-esptoolpy @ 1.40400.0 (4.4.0)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
    LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 39 compatible libraries
    Scanning dependencies…
    Dependency Graph
    |-- ArduinoJson @ 6.20.1
    |-- TFT_eSPI @ 2.5.21
    |-- ESPNtpClient @ 0.2.7
    |-- Time @ 1.6.1
    |-- AsyncTCP @ 1.1.1
    |-- ESP Async WebServer @ 1.2.3
    |-- SD @ 2.0.0
    |-- WiFi @ 2.0.0
    Building in release mode
    Linking .pio\build\esp32dev\firmware.elf
    c:/users/miko/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/…/lib/gcc/xtensa-esp32-elf/8.4.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib758\libESP Async WebServer.a(WebAuthentication.cpp.o):(.literal._ZL6getMD5PhtPc+0x4): undefined reference to mbedtls_md5_starts' c:/users/miko/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\lib758\libESP Async WebServer.a(WebAuthentication.cpp.o): in function getMD5(unsigned char*, unsigned short, char*)‘:
    D:\Dokumente\PlatformIO\Projects\esp32_espnow_server/.pio/libdeps/esp32dev/ESP Async WebServer/src/WebAuthentication.cpp:73: undefined reference to `mbedtls_md5_starts’
    collect2.exe: error: ld returned 1 exit status
    *** [.pio\build\esp32dev\firmware.elf] Error 1
    ========================================== [FAILED] Took 22.65 seconds ===================

Reinstalled AsyncTCP and AsyncWebswerver, but that didn’t fix the problem.
What’s wrong?

The ESPAsyncWebServer library has still failed to pull in a critical patch to fix this compile error, see

In your platformio.ini you can try and use the fixed library versions:

lib_deps =
   ; fixed ESPAsyncWebserver
   https://github.com/khoih-prog/ESPAsyncWebServer/archive/refs/heads/master.zip

or use a different version of the library that is not from me-no-dev, like

lib_deps =
   esphome/ESPAsyncWebServer-esphome@^3.0.0

I changed not only the framework, but also deleted a library from platformio.ini (esphome/ESPAsyncWebServer-esphome) that was left over from former version :sleeping:

Thank you!