Problem with xtensa-esp32-elf when compiling

Hello all,

I am new to PlatformIO and using it with ESP32. I am trying to compile the code cloned from here:, but I keep getting this error:

/Users/mahe/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
/Users/mahe/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find _vectors.o: No such file or directory
collect2: error: ld returned 1 exit status
*** [.pio/build/nodemcu-32s/firmware.elf] Error 1

I’m on macOS 10.15.4.

Can anyone help to point me in the right direction to solve this issue? Thanks!

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)
 - 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 ->
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 @

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 ===============

Removing the two lines worked! Thank you very much.

I do get a couple of yellow lines when compiling:

/Users/mahe/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':
/Users/mahe/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
/Users/mahe/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_data8 = &last_data;

It compiles, but when flashing the ESP32 it will not mount the file system:

Mounting SPIFFS...
E (29) SPIFFS: mount failed, -10025
[E][SPIFFS.cpp:89] begin(): Mounting SPIFFS failed! Error: -1
Failed to mount file system
Failed to mount SPIFFS !

You must, per documentation, upload the filesystem to the ESP32 separately, using the “Upload File System image” project task.

That’s because the people at Arduino-ESP32 did a release which compiles with these warnings. They already resolved it so it will be gone in the next release, see How to get rid of "warning: initialization from incompatible pointer type [-Wincompatible-pointer-types"].

I’m sorry - I was too eager, so I overlooked that step… It works - thank you very much!