Have not used Arduino for a year, and suddenly I get this error message when compiling or uploading a previously good program code:
fork/exec /Users/Kenneth2/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.3-arduino2/bin/avr-g++: bad CPU type in executable
Error compiling for board Arduino/Genuino Uno.
When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..
In a forum reply here, click on the reply field.
Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
Press "Ctrl + V". This will paste the error between the code tags.
Move the cursor outside of the code tags before you add any additional text to your reply.
If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.
Reply to Robin2:
Thanks for taking on my problem!
I am using Apple computer, operating system Mac OS Catalina.
Starting to use Arduino today, I updated the Arduino IDE and this might be the source of my problems.
I am really confused, since I installed the latest Arduino IDE on a separate Mac computer, which I have not previously used for Arduino programming, and I got the same error message.
this is the error message I get when I try to compile a program in the Arduino IDE:
Arduino: 1.8.6 (Mac OS X), Board: "Arduino/Genuino Uno"
fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: bad CPU type in executable
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
The problem is you are using an outdated version of Arduino AVR Boards with macOS Catalina. Catalina doesn't support 32 bit applications, so all the tools dependencies had to be updated to 64 bits. That has been done, but you aren't using the version that was updated.
I followed your instructions, and even restarted my computer after the procedure, but I still get this error message:
Arduino: 1.8.6 (Mac OS X), Board: "Arduino/Genuino Uno"
Build options changed, rebuilding all
fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: bad CPU type in executable
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
One point I am uncertain about is: when I click on Boards Manager, I find Arduino AVR Boards on top of the list of boards, and there is a box to the left saying "Select Version". Should I select a version there, before clicking on Update?
Something went wrong. You are still using the Arduino AVR Boards version bundled with Arduino IDE 1.8.6 (Arduino AVR Boards 1.6.22). The newest version of Arduino AVR Boards is 1.8.2, so when you did the update process I described above, it should have caused you to now be using Arduino AVR Boards 1.8.2.
kennethlundkvist:
when I click on Boards Manager, I find Arduino AVR Boards on top of the list of boards, and there is a box to the left saying "Select Version". Should I select a version there, before clicking on Update?
No, the selection from the version menu only matters if you click the "Install" button. If you click the "Update" button, it should automatically install the newest available version.
When you open Boards Manager, what version of Arduino AVR Boards does it show is installed?
The workaround is to just update to Arduino IDE 1.8.11, which comes with Arduino AVR Boards 1.8.2. Your Arduino IDE 1.8.6 is pretty outdated. But it should be possible to update to Arduino AVR Boards 1.8.2 while using Arduino IDE 1.8.6.