Segmentation fault

Whaaat? Here’s the error. I have been getting this off and on. The code is lengthy–when it compiles it takes 71% of flash and 75% of RAM. I often get “Low memory available, stability problems may occur.” or some such. Here’s the total segmentation fault error message:

In function ‘global constructors keyed to 65535_0_Shop_DU_2.0.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:\Users\Roger\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-gcc returned 1 exit status
compilation terminated.
c:/users/roger/appdata/local/arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/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 Nano.

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: https://github.com/arduino/Arduino/issues/7949

Here's the traditional 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 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.

Alternate workaround: One of the Arduino developers recently worked on this and claims to have fixed it. There is a special beta testing hardware package you can install via the Arduino IDE's Boards Manager that has the fix:

  • (In the Arduino IDE) File > Preferences
  • In the "Additional Boards Manager URLs" field, enter: http://downloads.arduino.cc/packages/package_avr_7.3.0_index.json
  • If you already have an additional Boards Manager URL in that field, you can separate multiple URLs with commas or click the button on the right side of the field to open a dialog that allows you to add each on its own line.
  • Click "OK"
  • Tools > Board > Boards Manager
  • Wait for the downloads to finish
  • Click on "Arduino AVR Boards by Arduino"
  • Click the "Update" button.
  • Wait for the update to finish.
  • Click "Close".

Dr_Quark, you know there is something like google ;)

lto internal compiler error: Segmentation fault

If you add arduino to the query, the results will even mostly be referring to this site (and Pert's solution) ;)

Dr_Quark, you know there is something like google :wink:

It’s a passing fancy. I’m still using the crank field phone at the ranch. But I will look into it.

Dr_Quark: Dr_Quark, you know there is something like google ;)

It's a passing fancy. I'm still using the crank field phone at the ranch. But I will look into it.

8) 8) 8)