I maintain a library called IRLib2 available at GitHub - cyborg5/IRLib2: Library for receiving, decoding, and sending infrared signals using Arduino
The library works perfectly using Arduino IDE 1.8.5 on Windows 10. However it will not compile the simplest examples using Arduino IDE 1.8.6 or 1.8.7. I get the following error messages when trying to compile "examples/dump.ino" for Arduino Uno using 1.8.6.
Arduino: 1.8.6 (Windows 10), Board: "Arduino/Genuino Uno"
lto1.exe: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624
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 (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status
compilation terminated.
c:/program files (x86)/arduino/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 Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I did a completely clean uninstall including the removal of User/AppData/Arduino15 and installed 1.8.7. I get the following error messages when compiling that same dump example.
Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Uno"
lto1.exe: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624
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 (x86)\Arduino\hardware\tools\avr/bin/avr-gcc returned 1 exit status
compilation terminated.
c:/program files (x86)/arduino/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 Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
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:
A workaround is described in the link above.
Here's a less desirable, but possibly easier alternative workaround:
Tools > Board > Boards Manager
Wait for downloads to finish.
When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
Click "Install".
Wait for installation to finish.
Click "Close".
Due to a bug, this alternative 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.
This is an old thread, but it does not offer the simplest solution.
The problem is the Pnames() method. The issue is fixed (temporarily?) by commenting out all calls to Pnames(). The most obvious one is located in the library dump() helper function. Other calls are made in some of the example code.