PlatformIO Community

Unable to compile empty project

I just installed the PlatformIO extension in VS Code and I cannot for the life of me get it to compile anything. I have tried both empty projects and example code, as well as various boards. I have also tried uninstalled/reinstalling VS Code and the PlatformIO extension numerous times.

I am using Windows 11 and VS Code version: 1.73.1
The PlatformIO extension lists Core: 6.1.5 and Home: 3.4.3

Below is the terminal output when attempting to compile an empty program with Arduino Uno selected as the board:


Processing uno (platform: atmelavr; board: uno; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (4.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\uno\src\main.cpp.o
Archiving .pio\build\uno\libFrameworkArduinoVariant.a
Compiling .pio\build\uno\FrameworkArduino\CDC.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\uno\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Print.cpp.o
Compiling .pio\build\uno\FrameworkArduino\Stream.cpp.o
*** [.pio\build\uno\src\main.cpp.o] Error 1
*** [.pio\build\uno\libFrameworkArduinoVariant.a] Error 1
*** [.pio\build\uno\FrameworkArduino\CDC.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\IPAddress.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\Print.cpp.o] Error 1
*** [.pio\build\uno\FrameworkArduino\Stream.cpp.o] Error 1

And below is the output when using the verbose build option:


Processing uno (platform: atmelavr; board: uno; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (4.0.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
avr-g++ -o .pio\build\uno\src\main.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -Iinclude -Isrc -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard src\main.cpp
avr-gcc-ar rc .pio\build\uno\libFrameworkArduinoVariant.a
avr-g++ -o .pio\build\uno\FrameworkArduino\CDC.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\CDC.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\HardwareSerial.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\HardwareSerial0.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\HardwareSerial1.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\HardwareSerial2.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packag*** [.pio\build\uno\src\main.cpp.o] Error 1
es*** [.pio\build\uno\libFrameworkArduinoVariant.a] Error 1
\fr*** [.pio\build\uno\FrameworkArduino\CDC.cpp.o] Error 1
ame*** [.pio\build\uno\FrameworkArduino\HardwareSerial.cpp.o] Error 1
wor*** [.pio\build\uno\FrameworkArduino\HardwareSerial0.cpp.o] Error 1
k-ar*** [.pio\build\uno\FrameworkArduino\HardwareSerial1.cpp.o] Error 1
dui*** [.pio\build\uno\FrameworkArduino\HardwareSerial2.cpp.o] Error 1
no-*** [.pio\build\uno\FrameworkArduino\HardwareSerial3.cpp.o] Error 1
avr*** [.pio\build\uno\FrameworkArduino\IPAddress.cpp.o] Error 1
\co*** [.pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o] Error 1
res\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\va*** [.pio\build\uno\FrameworkArduino\Print.cpp.o] Error 1
riants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\HardwareSerial3.cpp*** [.pio\build\uno\FrameworkArduino\Stream.cpp.o] Error 1

avr-g++ -o .pio\build\uno\FrameworkArduino\IPAddress.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\IPAddress.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\PluggableUSB.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\PluggableUSB.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\Print.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\Print.cpp
avr-g++ -o .pio\build\uno\FrameworkArduino\Stream.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -mmcu=atmega328p -Os -Wall -ffunction-sections -fdata-sections -flto -DPLATFORMIO=60105 -DARDUINO_AVR_UNO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\ethan\.platformio\packages\framework-arduino-avr\variants\standard C:\Users\ethan\.platformio\packages\framework-arduino-avr\cores\arduino\Stream.cpp

Please remove the folders

  • C:\Users\ethan\.platformio\packages\toolchain-atmelavr
  • C:\Users\ethan\.platformio\packages\framework-arduino-avr
  • C:\Users\ethan\.platformio\.cache

and try building again.

If it still fails, make sure your antivirus is temporarily disabled.

Thanks for the quick response. I removed those 3 directories and tried building again. Unfortunately, no luck. When I clicked Build, PlatformIO automatically reinstalled the tools, but I’m still getting the same build errors.

The only antivirus/firewall program that I have running is the built in Windows Defender. I turned that off as well, but still the same errors when trying to build.

  • Is the project directory in a cloud filesystem, like OneDrive or Dropbox? I’ve seen problems with that.
  • Open a CLI and execute pio pkg exec -p "toolchain-atmelavr" -c "avr-gcc --version". What does it return?

Just double-checked and the project is not saved in a cloud filesystem folder. I ran the command and got this output:

Using toolchain-atmelavr@1.70300.191015 package

That’s not right. You were supposed to be getting

grafik

Is there a C:\Users\ethan\.platformio\packages\toolchain-atmelavr@1.70300.191015 folder? Can you delete it and retry build the project?

Unfortunately, no C:\Users\ethan\.platformio\packages\toolchain-atmelavr@1.70300.191015 folder.

This is what I have in the packages directory:
image

And executing

toolchain-atmelavr\bin\avr-gcc --version

in this powershell also results in no output?

That command outputted this:
image

Then how come it is empty when avr-gcc is executed through pio pkg exec.

In a PlatformIO CLI (not a standalone shell), can you cd to the project directory (should already be the default) and execute pio run? Does the project magically build?

No luck there, unfortunately.
image

At this point I can only recommend a clean reinstall of PlatformIO. Remove the PlatformIO extension from VSCode, delete the entire C:\Users\ethan\.platformio folder, restart VSCode, reinstall the PlatformIO extension, retry creating a project in the default location (Documents\PlatformIO Projects).