some sketches wont work with my Sparkfun Pro Micro. seems library related

hi. i am using a sparkfun pro micro arduino clone for the first time. i have noticed some of my sketches wont compile or upload.
Board: "sparkfun pro micro"
processor:"atmega 32u4"
Programmer:" AVRSP mkII"

i am trying to run a large stepper very slowly and smoothly to build a welding lathe. im using a TB6560 driver and a stepper thats very similar to this:

here is the code im using that i found here on this forum (if you have something better im all ears)

i have managed to run the blink code on this board and some more simple stepper sketches.

i have a hunch that the problem is the library. perhaps its not compatible with the board. if this is the case then what is the point in making these new boards if they require you build new library's. this is very frustrating and i hope some one can help me out as im a bit over this horrible learning curve. it seems something is always wrong with arduinos. they never seem to work properly and im inclined to just ditch the hobby all together.

here is the code:

/* Include the library */
#include <AccelStepper.h>

// Initialize motor pins (1 = setup with stepper driver)
AccelStepper stepper(1, 8, 9);  // step pin = 8, dir pin = 9

/* Set the analogue pin the potentiometer will be connected to. */
#define POT_PIN A0

/* Set a dead area at the centre of the pot where it crosses from forward to reverse */
#define DEADZONE 20

/* The analogue pin will return values between 0 and 1024 so divide this up between
   forward and reverse */
#define POT_REV_MIN 0
#define POT_REV_MAX (512 - DEADZONE)
#define POT_FWD_MIN (512 + DEADZONE)
#define POT_FWD_MAX 1024

void setup()
  /* Set the number of steps to continuous so the the motor is always turning whilst
     not int the dead zone*/

void loop()

and here is the error:

Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\CDC.cpp: In member function 'available':

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\CDC.cpp:187:1: internal compiler error: Segmentation fault



Please submit a full bug report,

with preprocessed source if appropriate.

See <> 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

Using library AccelStepper in folder: C:\Users\topbl\Documents\Arduino\libraries\AccelStepper (legacy)
exit status 1
Error compiling for board SparkFun Pro Micro.

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.

would this be the case even though i am not using any of the boards in that package?

i am using a different package by sparkfun.

does this now mean i have to change the type of board i am using in the tools menu?

thanks for the quick reply

i was to quick to doubt. it worked perfectly. thank you sir.

in future what is the best way or site to post error messages to find out there meaning and fixes?

would this be the case even though i am not using any of the boards in that package?

In this case, it shouldn't because SparkFun AVR Boards shares the toolchain of Arduino AVR Boards. So if you roll back the Arduino AVR Boards toolchain you are also rolling back the toolchain used by SparkFun AVR Boards.

in future what is the best way or site to post error messages to find out there meaning and fixes?

This is definitely the best place to ask questions about Arduino. You did a great job using code tags when you posted your error messages. That really does help.

If you want to search for information on an error message, Google, etc. is probably best. The trick is to figure out the perfect amount of the error message to search for. For example, if you had searched for "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino\CDC.cpp:187:1: internal compiler error: Segmentation fault", you would get no results other than this post because it's too specific. If you search for "collect2.exe: error: ld returned 1 exit status" then you'll get tons of irrelevant results because that's just a generic message that means something went wrong. If you searched for "internal compiler error: Segmentation fault" "arduino" you would get some very good results. It's pretty tricky to determine which is the part of the error message to focus on. Sometimes I do search the arduino/Arduino GitHub repository's issue tracker because often you'll find the best information there straight from the Arduino developers:

It's a good idea to check the closed issues in the search results if you don't find anything in the open issues because frequently the Arduino developers have already fixed a bug, but there just hasn't been a production release of the Arduino IDE since the fix.

excellent answer. thank very much

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