Compilation error: Error: 2 UNKNOWN: exec: "/bin/avr-g++": file does not exist

When I try to Verify a sketch this is the error I get. I have tried removing the Arduino15 folder contents and reinstalling the board manager (Arduino AVR Boards by Arduino). I have tried installing version 1.6.21 of that board manager as I found some forums that said there were issues with 1.6.22 and newer but no solution has worked so far. In the classic Arduino IDE I can compile and run sketches just fine, but with the 2.0 beta I always get:

Using board 'mega' from platform in folder: C:\Users\arcti\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3
Using core 'arduino' from platform in folder: C:\Users\arcti\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3
Detecting libraries used...
/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Users\\arcti\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\cores\\arduino" "-IC:\\Users\\arcti\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\variants\\mega" "C:\\Users\\arcti\\AppData\\Local\\Temp\\arduino-sketch-687A61D017DF9EB70F17061437DE4594\\sketch\\newBlink.ino.cpp" -o nul
Compilation error: Error: 2 UNKNOWN: exec: "/bin/avr-g++": file does not exist

Any suggestions?

I am trying to compile for "Arduino Mega or Mega 2560" as the selection under board manager if that is pertinent.

1 Like

traptw1thin:
I have tried removing the Arduino15 folder contents

That usuall does fix this type of error. Was it the C:\Users\arcti\AppData\Local\Arduino15 folder that you removed? The reason I ask is because older versions of the Arduino IDE used C:\Users\arcti\AppData\Roaming\Arduino15, so you might have that folder on your computer also and it's easy to get them mixed up.

Hello,
I've got the same message when trying to address an ARDUINO ZERO.
I already tried out the following:

  • Deleting the packaging - folder in
    C:\Users\AL\AppData\Local\Arduino15
    and reload the boards.
  • Uninstalling IDE 2.0 and the standard version 1.8.3, then a new installation of 2.0

Interestingly, both IDE - versions work fine with the UNO but show the above error message.

It would be great someone could help me out, because I bougth the ZERO to use the debugging capabilities.

Thanks in advance,
Arpela

Just to be sure that I removed the right Arduino15 folder I did it again today. I have no Arduino15 folder in the C:\Users\arcti\AppData\Roaming location, and I did have one in C:\Users\arcti\AppData\Local. I believe I did the same thing before, but today I removed the Arduino15 folder and reinstalled the Arduino AVR Boards by Arduino. Unfortunately, it still has the same error.

Sorry for the delay in response COVID hit me hard.

UPDATE: I don't know exactly what fixed it but I will try to put down, to my best memory, what I did in case it helps someone else. Between some of the installs and reinstalls I may have closed the Arduino Pro IDE and reopened it, but not all. There is one time right before it fixed itself that I do note below.

I uninstalled and reinstalled the newest version of Arduino AVR Boards by Arduino like 6 times, this did not change the error.
NOTE: After the first time I didn't do it by removing the Arduino15 folder, I went to the Boards Manager on the left hand side of the Arduino Pro IDE and there's an icon "Installed" that when you hover over it it changes to "Uninstall" and I clicked that.

I uninstalled the same board manager and reinstalled version 1.6.21, this did not change the error.

I reinstalled the newest version, no change, then uninstalled it.

I randomly picked an older version (1.6.10) and installed that, tried to upload the sketch, this resulted in a new error:

c:/users/arcti/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avr6/crtatmega2560.o:(.init9+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
Compilation error: Error: 2 UNKNOWN: exit status 1

I closed the Arduino Pro IDE because the "Installed" icon in boards manager was not showing up.

When I reopened the Arduino Pro IDE something popped up in the bottom right corner about the (image? or something) for the Board connected has been updated and the options are some like "Manually Install" or "Yes". I selected "Yes". This installed the newest version of the Arduino AVR Boards by Arduino board manager. And then uploaded the sketch and now it works.

NOTE: Each time you uninstall and reinstall the board manager you have to reselect the board from Tools menu. It will look like its selected since it says your board name, but if you hover over that it will have your boards manager, hover over that and you will see that no board is selected.

I'm glad to hear it's working now. Thanks for taking the time to post an update.
Best wishes, Per

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.