PlatformIO is Broken for any esp32!

rocessing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP32 Dev Module
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 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Generating partitions .pio\build\esp32dev\partitions.bin
Archiving .pio\build\esp32dev\libFrameworkArduinoVariant.a
Indexing .pio\build\esp32dev\libFrameworkArduinoVariant.a
Compiling .pio\build\esp32dev\FrameworkArduino\Esp.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\IPv6Address.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\Print.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\WString.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\base64.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-bt.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-gpio.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-log.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-matrix.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-misc.c.o
Access is denied.
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-psram.c.o
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-i2c.c.o] Error 1
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-ledc.c.o] Error 1
Access is denied.
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-log.c.o] Error 1
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-matrix.c.o] Error 1
Access is denied.
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-psram.c.o] Error 1
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-misc.c.o] Error 1
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-gpio.c.o] Error 1
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-dac.c.o] Error 1
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-bt.c.o] Error 1
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-cpu.c.o] Error 1
Access is denied.
*** [.pio\build\esp32dev\FrameworkArduino\esp32-hal-adc.c.o] Error 1
======================================================= [FAILED] Took 27.40 seconds =======================================================
The terminal process "C:\Users\zacar\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

My windows defender is turn off (temporarily) completely. This is what i get when i create a new project and try to build. After that, ALL projects do this.

I can only get a project to build correctly once if i delete the .platofrmio/packages + .platofrmio/platforms + .platofrmio/.cache folders. Then the exmaple builds, but promtply stops building as soon as i try to create a new project.

All of these files are on my C: drive -nothing is on a network drive or another drive on my machine.

this windows popup was what appened when i tried to run xtensa-esp32-elf-gcc.exe when it was 0 bytes. still it’s strange that is go corrupted again, mine is doing fine now

no matter what i do, it doesn’t work. I’ve tried everything that i can think of :frowning: rebooted my machine, checked user permissions, ran the VSCode compatalibty troubleshooter - i am hoenstly ready to reinstall windows rn.

Antivirus? Possible other things corrupting your harddrive as you try to re-download? I mean you can redownload the compiler package again (by deleting .cache and toolchain-xtensa), but it shouldn’t happen 3 times in a row that it gets corrupted…

1 Like

it’s happened every time, i have no antivirus turned on (only have windows defender on my machine). I am at a loss, i have changed nothing about my installtion, just booted up this morning to do some work and get this

if i delete the suggested folders, i can open my projects and build them. The second i create a new project - my entire platformio installation becomes corrupted. I have no idea why, nothing else on my machine is malfunctioning.

i’ve varified that my permissions are adequate - and even ran vscode as admin - still the same. I noticed that some parts of Github and a bunch of other platforms are down with a 500 error today - could the server Platformio is connecting to during the new-project-creation be malfunctioning or not able to connect to certain urls/repos?

EDIT: Alright, i installed VScode on my wifes laptop - never had ANY ide on it at all, same thing. Exact same errors, and same issue. At this point, i 100% know it is not my machine.

EDIT2: Some time later, i have solved it.

I tried vscode on another machine, same thing. However, when I logged out of my account on the other machine, disabled all extensions but the platformio and c++ extensions required by pio - the issue STILL happened. This told me it was not my machines - but something wrong with my extensions, so I went and checked the c++ extension - it was on the pre-release version. I switched to the release version - problem solved (for now). I am absolutely positive this was the cause of the issue. I tried everything prior, reinstalling vscode, reinstalling platformio (10 times might I add), checking user permissions, disabling windows defender, etc etc. Nothing worked. Check your c++ extension and ensure that it is on the ´release´ version, not the ´pre-release´. Then, delete the contents of the ´.platformio/packages´, ´.platformio/platforms´, ´.platformio/.cache´ folders and rebuild the project.

5 Likes

This works indeed, thank you for posting the solution…

1 Like

Is today harddrive corruption / antivirus goes berserk day? It’s extremely unusual to have that high of a concentration of “my PlatformIO build just broke” posts o_O

“… Check your c++ extension and ensure that it is on the ´release´ version, not the ´pre-release´. Then, delete the contents of the ´.platformio/packages´, ´.platformio/platforms´, ´.platformio/.cache´ folders and rebuild the project.”

Yes this seems to work. You may get an error as it takes time to rebuild and you may have to do it for every project.

seems like it, haha. I am still trying to figure out when my vscode switched to the pre-release version of the c/c++ extension. I’d never consciously do that, very weird. The generated junk files was also especially weird, never expereinced this kind of bug before. Hopefully ya’ll (platformio staff) get this squared away. Please, let us (community) know what we can do to assist.

1 Like

Thx a lot @zanzythebar
your solution works fine

1 Like

I keep running into this error /.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find Inc\Documents\Arduino\TestESP32\.pio\build\adafruit_feather_esp32s3_tft\firmware.map: No such file or directory collect2.exe: error: ld returned 1 exit status *** [.pio\build\adafruit_feather_esp32s3_tft\firmware.elf] Error 1

And I’ve deleted all the folders as well as disable all extensions and check C++ version. Anyone have a fix for this?

Do you have a space in your username? C:\Users\<something> Inc\ seems to get broken apart here.

I do, could this be the issue? It seems like it’s missing this file from that file map. I can try finding that from the ESP32 files on github I suppose.

No, it’s trying to generate the map file. The linker produces this. It can’t find the folder in which it’s supposed to put it.

What distrubs me the most is that this issue was already known and fixed a long time ago, over a year ago, at

Are you sure you’re using a recent version of platform-espressif32 in your project? Do CLI - >pio pkg update -g -p espressif32 to be sure.

Hi Max,

Please correct me if I did this incorrectly.

I went to PlatformIO Core CLI and then typed in pio pkg update -g - p esspressife32 and it is saying that everything is up to date.

Can you create + upload a minimal project with which that error occurs? Does it also fail on arduino-blink?

Do you mean create + upload and post the files here? Yes it also fails on Arduino blink. I created a whole new project to test if Arduino blink worked and it did not.

Actually you may be running into firmware.map: Invalid argument · Issue #1068 · platformio/platform-espressif32 · GitHub. Maybe you have both non-english characters and spaces in your name, but the non-english characters are the problem.