I have a code with these two lines:

  char handshakecode = "S"; // Capital S
  char receive;

The lines of code are placed in a separate void, and not setup or loop. When i change the two variables from char to String i get a error(complete error at bottom) when compiling to the arduino or verifying the code.

  String handshakecode = "S"; // Capital S
  String receive; 

When i snippes out partial code for just that particular void, it compiles fine, so it must be in combination with the rest of the code, which i have left out from this post at the moment.

Is this a known error or am I doing something wrong?

In function 'global constructors keyed to 65535_0_WFS_v0.3.ino.cpp.o':

lto1.exe: 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.15.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files/windowsapps/arduinollc.arduinoide_1.8.15.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.

  • that does not look like a compilation error ... that looks like a compiler program failure .... try reinstalling the Arduino IDE
    – jsotola
    Commented Nov 28, 2018 at 21:16
  • This is a known error with the windows store version of the IDE. Delete it and download it from Arduino.
    – Majenko
    Commented Nov 28, 2018 at 21:58
  • 1
    @Majenko it happens with the regular version of the Arduino IDE also.
    – per1234
    Commented Nov 28, 2018 at 22:51
  • Interesting. It used to just be the app version. I guess they messed up the real version. Another reason to switch to UECIDE I guess :)
    – Majenko
    Commented Nov 28, 2018 at 23:20
  • I encountered the bug using the standard Arduino IDE back when the new toolchain was still in beta testing, as well as with the production release. I'm normally all about using the latest versions of everything but I'm stuck with Arduino AVR Boards 1.6.21 until this gets fixed.
    – per1234
    Commented Nov 29, 2018 at 7:52

1 Answer 1


This bug is specific to the 5.4.0-atmel3.6.1-arduino2 version of avr-gcc used by Arduino AVR Boards 1.6.22 and newer. It has been reported here:


Here's the workaround:

  1. Tools > Board > Boards Manager
  2. Wait for downloads to finish.
  3. When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
  4. Click "Install".
  5. Wait for installation to finish.
  6. Click "Close".

Due to a bug, this workaround doesn't work with Arduino IDE 1.8.6, but it will work with any other version of the Arduino IDE.

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.