Difficulty compiling sketches for Arduino Mega 2560

I’ve been having some difficulties while compiling sketches for an Arduino Mega 2560. There’s nothing wrong with the sketches themselves, as I downloaded them from a well-known Github repository, but I get the following error when I try to compile them:

sketch\src\lcd\menu\menu.h: In function ‘action_edit.constprop’:

sketch\src\lcd\menu\menu.h:205:5: internal compiler error: Segmentation fault



Please submit a full bug report,

with preprocessed source if appropriate.

See http://gcc.gnu.org/bugs.html for instructions.

lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files/windowsapps/arduinollc.arduinoide_1.8.21.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

I’m not familiar enough with the inner workings of Arduino to interpret this error, so I’ve been having some trouble. I’ll take any help that I can get.


This is a bug with the outdated version of Arduino AVR Boards you're using. Please update to Arduino AVR Boards 1.8.1 to fix the bug:

  • Tools > Board > Boards Manager
  • Wait for downloads to finish.
  • From the list of available packages, click on Arduino AVR Boards.
  • Click "Update".
  • Wait for the update to finish.
  • Click "Close".

It worked! Thank you very much for your help.