Exit Status 1 - Error compiling for board Arduino/Genuino Uno. A Fix

I got this vaguely familiar Error with a re-purposed piece of code, and searched the Forum for help. It seemed none of the causes found in previous posts was applicable, but then I remembered what I had done years ago in an attempt to fix it, tried it, and it worked this time too, so I thought I would share it.

Select and copy all the code in the sketch that produces this error.

Open a new sketch and select all the template code, then paste your copied code.

Save the result, then see if it will compile. Unless there are errors of the type described in previous posts, like incomplete included library sets or using unsupported library functions, this may work. It always has for me.

More experienced members may be able to explain why, and I'd welcome their insights, but if you are stuck with Exit Status 1, give it a try. You might be pleasantly surprised.

Exit status 1 is just a generic error message that only tells you something went wrong. There are a nearly infinite number of possible causes with almost as many fixes.

What you need to do is read through the contents of the black console window at the bottom of the Arduino IDE window to see the specific error messages that will tell you what the problem is. You may need to scroll that window up to see it all.

If you want an explanation for the error, you need to post the full error output here. It's impossible for us to know what could have caused exit status 1.

I've emboldened my text to distinguish it from the logs. The compilation log before using copy and paste is immediately below. Stand fast the coding errors that are probably the reason the sketch does not perform as intended, which I am attempting to resolve without recourse to the Forum. The point of interest in my original post is why does the copied and pasted version compile, when the original doesn't?
The second log comes after the emboldened text which immediately follows this log entry.
Pre copy and paste log

O:\Documents\Projects\Arduino\Immersion_Control\GetSolaXTest-01\GetSolaXTest-01.ino: In function 'void GetSolaXData()':

O:\Documents\Projects\Arduino\Immersion_Control\GetSolaXTest-01\GetSolaXTest-01.ino:53:42: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

if (client.findUntil("Data", "\0"))

^

O:\Documents\Projects\Arduino\Immersion_Control\GetSolaXTest-01\GetSolaXTest-01.ino:53:42: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

O:\Documents\Projects\Arduino\Immersion_Control\GetSolaXTest-01\GetSolaXTest-01.ino:55:59: warning: invalid conversion from 'const char*' to 'char' [-fpermissive]

String RealTimeData = client.readStringUntil("]");

^

In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29:0,

from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:232,

from sketch\GetSolaXTest-01.ino.cpp:1:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Stream.h:108:10: note: initializing argument 1 of 'String Stream::readStringUntil(char)'

String readStringUntil(char terminator);

^

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetClient.cpp: In member function 'connect':

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\libraries\Ethernet\src\EthernetClient.cpp:40:1: 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 Uno.

Post copy and paste log:-

O:\Documents\Projects\Arduino\Immersion_Control\sketch_jun14a\sketch_jun14a.ino: In function 'void GetSolaXData()':

O:\Documents\Projects\Arduino\Immersion_Control\sketch_jun14a\sketch_jun14a.ino:53:42: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

if (client.findUntil("Data", "\0"))

^

O:\Documents\Projects\Arduino\Immersion_Control\sketch_jun14a\sketch_jun14a.ino:53:42: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

O:\Documents\Projects\Arduino\Immersion_Control\sketch_jun14a\sketch_jun14a.ino:55:59: warning: invalid conversion from 'const char*' to 'char' [-fpermissive]

String RealTimeData = client.readStringUntil("]");

^

In file included from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/HardwareSerial.h:29:0,

from C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Arduino.h:232,

from sketch\sketch_jun14a.ino.cpp:1:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/Stream.h:108:10: note: initializing argument 1 of 'String Stream::readStringUntil(char)'

String readStringUntil(char terminator);

^

Sketch uses 15930 bytes (49%) of program storage space. Maximum is 32256 bytes.
Global variables use 870 bytes (42%) of dynamic memory, leaving 1178 bytes for local variables. Maximum is 2048 bytes.

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 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".

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.

You copying the code to a new sketch fixed this only by chance. This bug is very tricky in that it comes and goes without any rhyme or reason. Making a tiny change in your code can cause it to appear or disappear.

Thanks pert. I've made a note to refer to your fix if things go awry again, but as you say it's spasmodic, so Ill live with it for now.

It's a while since posts and replies on this topic, but I though an update was in order. A number of "fixes" were proposed.

  1. change the function definitions around - that didn't work.
  2. copy and paste the text of the failing sketch into a new one. As with many other issues, that worked, but only temporarily.
  3. revert to board AVR Board version 1.6.21 - Thanks pert for that one which worked, and after many edits and recompiles of a number of variations of the offending code to chase down other problems, is still working. No segmentation errors since.

An aside though; Windows 10 did a major update about a month ago, since which the IDE has compiled far faster than it ever did before. However, I want to eradicate problems with my project before testing the latest versions of all, including AVR boards, in the new Windows environment.

Thanks to all who offered help and potential solutions, especially pert.

You're welcome. I'm glad if I was able to be of assistance. Thanks for taking the time to post an update.

Enjoy!
Per