PIO is broken - help installing avr-g++

Hi, any help with this problem much appreciated. My Platformio install is completely non functional because PIO can no longer find avr-g++ after having worked just fine for over a year.

I have looked in the help docs here but adding the line:

platform = platformio/atmelavr@^3.4.0 did not solve the problem.

As far as I can see from help docs, PIO should install dependencies such as avr-g++, but hasn’t in this case.

So I’m not sure how to deal with this and before I remove VSCode and PIO I thought I’d check for advice. Thanks.

Open a commandline with Windows+R → cmd.exe. Execute (without modifications)

"%userprofile%\.platformio\packages\toolchain-atmelavr\bin\avr-gcc" --version

what does it return?

The system cannot find the path specified.

do I need to execute the line from a particular place?

but also just to let you know that the folder \toolchain-atmelavr\ does not contain a folder named bin

the only items in \toolchain-atmelavr\ are a folder named avr and a file called .piopm

I have found avr-gcc by searching C: and it exists in

c:\users\paul\appdata\local\arduino15\packages\arduino\tools (note case is not correct as I typed this path)

That’s the Arduino IDE installation, that’s separate.

Please start a CLI and execute

pio platform install atmelavr --with-package toolchain-atmelavr

Does the original command now return something?

this is what I got when executing

pio platform install atmelavr --with-package toolchain-atmelavr

PS C:\Users\Paul\Documents\PlatformIO\Projects\Arduino-Master-Radio> pio platform install atmelavr --with-package toolchain-atmelavr
Platform Manager: atmelavr @ 3.4.0 is already installed
Tool Manager: toolchain-atmelavr @ 1.70300.191015 is already installed
The platform 'atmelavr' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
PS C:\Users\Paul\Documents\PlatformIO\Projects\Arduino-Master-Radio> 

and the original command (executed in windows commandline )
“%userprofile%.platformio\packages\toolchain-atmelavr\bin\avr-gcc” --version

returns the same as before - The system cannot find the path specified.
thanks for help

What folderes exist within C:\Users\Paul\.platformio\packages?


and within toolchain-atmelavr there is one folder as before called avr and one file .piopm

What folders exist in toolchain-atmelavr, and if possible, therein within bin/?

so although the toolmanager states:

Tool Manager: toolchain-atmelavr @ 1.70300.191015 is already installed

it obviously is not…

i also tried renaming the toolchain-atmelavr folder and then using

pio platform install atmelavr --with-package toolchain-atmelavr

but the result is the same.
how does PIO check if the toolchain is present?

Is the toolchain-atmelavr folder completely empty? It might just check it on folder existance.

Try removing the toolchain-atmelavr folder along with .platformio/.cache (might be a hidden folder).

thanks for this. So now the compiler is back, but I am back to this wire lib error and to try to combat that, I’ve put the reference to the liquid crystal lib in the main.cpp file instead of the header, but still get the below

Executing task: C:\Users\Paul\.platformio\penv\Scripts\platformio.exe run <

Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR (3.4.0) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
 - 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 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <LiquidCrystal> 1.5.0
Building in release mode
Compiling .pio\build\megaatmega2560\src\Two_Way_Radio_Master.cpp.o
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\LiquidCrystal.cpp.o
Compiling .pio\build\megaatmega2560\libaf5\LiquidCrystal\LiquidCrystal_I2C.cpp.o
.pio\libdeps\megaatmega2560\LiquidCrystal\I2CIO.cpp:54:13: fatal error: Wire.h: No such file or directory

* Looking for Wire.h dependency? Check our library registry!
* CLI  > platformio lib search "header:Wire.h"
* Web  > https://registry.platformio.org/search?q=header:Wire.h

    #include <Wire.h>
compilation terminated.
*** [.pio\build\megaatmega2560\libaf5\LiquidCrystal\I2CIO.cpp.o] Error 1
====================================================================================== [FAILED] Took 3.19 seconds ======================================================================================
The terminal process "C:\Users\Paul\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

ok, solved I put wire in lib_deps

thanks very much for getting me going again, much appreciated.