Problem with xtensa-esp32-elf when compiling

Reproducable on Windows, too.

PLATFORM: Espressif 32 (3.1.0) > NodeMCU-32S
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (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 0.0.0+sha.371f382
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
...
Linking .pio\build\nodemcu-32s\firmware.elf
c:/users/max/.platformio/packages/toolchain-xtensa32@2.50200.97/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory
c:/users/max/.platformio/packages/toolchain-xtensa32@2.50200.97/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\nodemcu-32s\firmware.elf] Error 1
=============== [FAILED] Took 32.87 seconds ===============

Works if I remove the lines

In general, it’s not safe / good to reference a bleeding-edge version of something. The repo will always progress and e.g. require a higher toolchain version at some point, and break older projects.

Alternative, the projects builds by also using a newer compiler

platform_packages =
   framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
   toolchain-xtensa32@~2.80400.0  

and an additional (long) cast in the src/main.cpp code

  if(abs((long)(time_now-time_last))>=PID_INTERVAL or time_last > time_now) {

but I wouldn’t recommend using bleeding-edge stuff.

RAM:   [=         ]  13.3% (used 43564 bytes from 327680 bytes)
Flash: [========= ]  90.1% (used 1181120 bytes from 1310720 bytes)
=============== [SUCCESS] Took 7.21 seconds ===============