Collect2.exe: error: ld returned 1 exit status, in ESP32 but ok in STM32

  1. Arduino core 2.0.0 support is not stable yet and the above platform_packages is a hack (Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub)
  2. Using the 8.4.2 compiler from the PlatformIO repositories did not work me when using 2.0.0, see Use different version of Arduino framework on espressif platform - #6 by maxgerhardt
  3. If it stills fail at linking, check if std::to_string works in the Arduino-IDE for Arduino-ESP32. If it also fails → bug report to Arduino-ESP32, work-around std::to_string usage (e.g., construct a simple Arduino String object from the to-be-converted parameter, then .c_str() it). If it works in the Arduino-IDE, wait for proper Arduino core 2.0.0 integration or avoid std::to_string usage.