Error message

Not sure what happened here. Anyone have any idea what this means?

Arduino: 1.8.7 (Windows Store 1.8.15.0) (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\xxxx\Documents\Arduino\libraries\AccelStepper\src\AccelStepper.cpp: In member function 'AccelStepper::setAcceleration(float) [clone .part.9]':

C:\Users\xxxx\Documents\Arduino\libraries\AccelStepper\src\AccelStepper.cpp:296: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.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.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

It's a 1.8.7 problem. I don't know if it has been fixed in the hourly build or not.

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:

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

There have been numerous reports of unique errors with version 1.8.7 of the IDE. Revert back to an earlier, stable release. 1.8.5 is a good choice.

It's only an Arduino IDE version-specific thing in that Arduino IDE 1.8.6-1.8.7 ship with the problematic Arduino AVR Boards versions bundled. The same problem will happen even if you use Arduino IDE 1.8.5 with Arduino AVR Boards 1.6.22 or 1.6.23. It's a compiler issue, not an IDE issue.

The only significant bug I can think of that's specific to Arduino IDE 1.8.7 is this:

That will only occur under a very specific set of circumstances (Upload Using Programmer when nothing has ever been selected from the Tools > Port menu in any IDE version) and I don't remember even seeing it reported once on this forum. I guess it's more prevalent on the Adafruit forum since it affects their Trinket board.

Thanks!

Still happening occasionally with IDE 1.8.7 & avr board 1.6.21

Verbose output and sketch files attached:

I can get it to fail about 1 out of 10 times with this sketch. My impression is that it fails more often with longer, more complicated sketches.

I haven’t been seeing this error at all prior to about 2-3 days ago.

Frank

StepperSpeedCtrl.ino (2.37 KB)

verbose.txt (12.5 KB)

paynterf:
Still happening occasionally with IDE 1.8.7 & avr board 1.6.21

I'm not familiar with the workings of Visual Micro but there is nothing in that output that indicates you're using Arduino AVR Boards 1.6.21. In fact, the output clearly shows that the problematic avr-gcc 5.4.0-atmel3.6.1-arduino2 bundled with the Arduino IDE 1.8.7 is being used:

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc

If Arduino AVR Boards 1.6.21 was correctly being used, the path to avr-gcc would look something like this:

C:\Users\Frank\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2

So you either have something configured wrong or else there is a bug in Visual Micro causing Arduino AVR Boards 1.6.21 to not be used.

pert:
I'm not familiar with the workings of Visual Micro but there is nothing in that output that indicates you're using Arduino AVR Boards 1.6.21. In fact, the output clearly shows that the problematic avr-gcc 5.4.0-atmel3.6.1-arduino2 bundled with the Arduino IDE 1.8.7 is being used:

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc

If Arduino AVR Boards 1.6.21 was correctly being used, the path to avr-gcc would look something like this:

C:\Users\Frank\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2

So you either have something configured wrong or else there is a bug in Visual Micro causing Arduino AVR Boards 1.6.21 to not be used.

Clearly?? You must be joking. :o How does a mere mortal like myself know that

C:\Users\Frank\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2

Implies AVR boards 1.6.21, and

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc

Implies avr-gcc 5.4.0-atmel3.6.1?

I actually think you might be right about a bug in Visual Micro. I have checked and double-checked that VM shows the same boards version as the Arduino IDE, but I have seen other behavior that leads me to believe it isn't honoring the IDE boards version selection.

Frank

paynterf:
Clearly?? You must be joking. :o How does a mere mortal like myself know that

I meant clearly to me, and that's only after years getting to know this stuff through stumbling around.

paynterf:
C:\Users\Frank\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2

Implies AVR boards 1.6.21, and

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc

Implies avr-gcc 5.4.0-atmel3.6.1?

The Arduino IDE comes with the latest version (at the time of the IDE release) of Arduino AVR Boards bundled. The reason for this is to allow the users of the most popular Arduino boards to get started right away without any additional installation step. The bundled Arduino AVR Boards is located in the hardware subfolder of the Arduino IDE installation folder. Arduino IDE 1.8.7 bundles Arduino AVR Boards 1.6.23. Each version of Arduino AVR Boards uses a specific version of avr-gcc. In the case of Arduino AVR Boards 1.6.23, that version is avr-gcc 5.4.0-atmel3.6.1, which unfortunately has this segmentation fault bug.

When you install a hardware package using Boards Manager, it is installed to the C:\Users\Frank\AppData\Local\Arduino15\packages folder and the specific versions of any tool dependencies are also installed under that folder. The avr-gcc version used by Arduino AVR Boards 1.6.21 is 4.9.2-atmel3.5.4-arduino2. The upgrade to 5.4.0-atmel3.6.1 was made in Arduino AVR Boards 1.6.22.

So that is how I know that, if you're using Arduino IDE 1.8.7, C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc contains avr-gcc 5.4.0-atmel3.6.1.

Pert,

Thanks for the explanation - that makes so much more sense now. I followed your path descriptions, and can see where the package installed by Board Manager is indeed pointing to 4.9.2-atmel3.5.4-arduino2.

At the same time, I can see that in VS2017/Visual Micro, the Board Manager shows V1.6.21 installed, which is consistent with what you are saying. So, I think it's also safe to say that Visual Micro isn't honoring the Board Manager installation rev, and instead is using 1.6.23/5.4.0

I compiled the same project using the Arduino IDE, and verified that it is using 4.9.2/1.6.21 as follows:

Using board 'mega' from platform in folder: C:\Users\Frank\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21
Using core 'arduino' from platform in folder: C:\Users\Frank\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21
Detecting libraries used...
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino" "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\variants\\mega" "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\sketch\\StepperSpeedCtrl.ino.cpp" -o nul
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino" "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\variants\\mega" "-IC:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src" "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\sketch\\StepperSpeedCtrl.ino.cpp" -o nul
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino" "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\variants\\mega" "-IC:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src" "C:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src\\Stepper.cpp" -o nul
Generating function prototypes...
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino" "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\variants\\mega" "-IC:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src" "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\sketch\\StepperSpeedCtrl.ino.cpp" -o "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino" "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\variants\\mega" "-IC:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src" "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\sketch\\StepperSpeedCtrl.ino.cpp" -o "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\sketch\\StepperSpeedCtrl.ino.cpp.o"
Compiling libraries...
Compiling library "Stepper"
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\cores\\arduino" "-IC:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.6.21\\variants\\mega" "-IC:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src" "C:\\Program Files (x86)\\Arduino\\libraries\\Stepper\\src\\Stepper.cpp" -o "C:\\Users\\Frank\\AppData\\Local\\Temp\\arduino_build_758560\\libraries\\Stepper\\Stepper.cpp.o"
Compiling core...
"C:\\Users\\Frank\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.9.2-atmel3.5.4-

I had mentioned the possibility of Visual Micro not honoring the downgrade from 1.6.23 to 1.6.21 once before on the VM forum, but didn't have anything more than my own inferences from observed behavior to back it up - now I can add some additional weight to the argument - yay!!

Thanks again for giving a mere mortal a peek behind the curtain! :wink:

Frank

You're welcome. I'm glad if I was able to be of assistance.

It's quite unfortunate that Visual Micro has that behavior, since a hardware package may have been specifically written for a particular version of a tool.