Error while detecting libraries...

Hi Everyone,

I just installed IDE 1.8.13 on my Windows 10. I have a Leonardo. I'm pretty sure that I've selected the correct port and board in the Tools options. I am trying to run the simple Blink example. The following output is produced when trying to upload:

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\USERNAME\Documents\Arduino\libraries -fqbn=arduino:avr:leonardo -vid-pid=2341_8036 -ide-version=10813 -build-path C:\Users\USERNAME\AppData\Local\Temp\arduino_build_734354 -warnings=all -build-cache C:\Users\USERNAME\AppData\Local\Temp\arduino_cache_902319 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\USERNAME\Documents\Arduino\libraries -fqbn=arduino:avr:leonardo -vid-pid=2341_8036 -ide-version=10813 -build-path C:\Users\USERNAME\AppData\Local\Temp\arduino_build_734354 -warnings=all -build-cache C:\Users\USERNAME\AppData\Local\Temp\arduino_cache_902319 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino
Using board 'leonardo' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Leonardo"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\leonardo" "C:\Users\USERNAME\AppData\Local\Temp\arduino_build_734354\sketch\Blink.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Error while detecting libraries included by C:\Users\USERNAME\AppData\Local\Temp\arduino_build_734354\sketch\Blink.ino.cpp
Generating function prototypes...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 "-DUSB_MANUFACTURER="Unknown"" "-DUSB_PRODUCT="Arduino Leonardo"" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\leonardo" "C:\Users\USERNAME\AppData\Local\Temp\arduino_build_734354\sketch\Blink.ino.cpp" -o "C:\Users\USERNAME\AppData\Local\Temp\arduino_build_734354\preproc\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
avr-g++: error: device-specs/specs-atmega32u4: No such file or directory
exit status 1
Error compiling for board Arduino Leonardo.

(I've replaced my user name with USERNAME in all the paths above).

What I've tried:

  1. Uninstall and re-install -> didn't work
  2. Whitelisted (i.e. added to the exclude list) arduino.exe and all related folders in virus protection -> didn't work
  3. Tried on another computer, using same USB cable and same Leonardo -> that worked

I am at a loss at what else I can try to troubleshoot. Any help is greatly appreciated.

Do this:

  • Start Windows Control Panel.
  • Navigate to System and Security > System > Advanced system settings.
  • Click the "Advanced" tab.
  • Click the "Environment variables..." button.
  • In the "System Variables" list, you should see "GCC EXEC PREFIX". Click on it.
  • Click the "Delete" button.
  • Click the "OK" button.

The error should now be fixed.

Hi,

I followed your instructions step-by-step and it immediately solved the issue. Thank you so much!

You're welcome. I'm glad to hear it's working now. Enjoy!
Per