avr-g++: bad CPU type in executable

I have the same problem it is because of the max beta i just installed beta 2 still same problem. I also tried the arduino 2 (beta) also not working. Is there currently any workaround ?

Solution is download the latest build here Mass update bundled resources by facchinm · Pull Request #8976 · arduino/Arduino · GitHub

voor mac hier http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8976-BUILD-869-macosx.zip

Gielk:
Solution is download the latest build here Mass update bundled resources by facchinm · Pull Request #8976 · arduino/Arduino · GitHub

voor mac hier http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8976-BUILD-869-macosx.zip

This worked for me as well. Using Beta 3

FYI, This issue is being tracked here: IDE hangs on compile Mac OSX Mojave · Issue #8626 · arduino/Arduino · GitHub

I use NodeMCU board on Mac - with 1.8.10 compile is exponentially faster!! Couldn't help myself to donate again - thank you guys!!

Gielk:
Solution is download the latest build here Mass update bundled resources by facchinm · Pull Request #8976 · arduino/Arduino · GitHub

voor mac hier http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8976-BUILD-869-macosx.zip

Worked for me Thanks !!!!!!!!

I had a similar issue.

For me the solution was to rename the folder "~/Library/Arduino15/packages/arduino/tools/avr-gcc" to "~/Library/Arduino15/packages/arduino/tools/avr-gcc-old". This folder contains old 32-bit binaries. After renaming this folder, arduino uses the 64-bit binaries in "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin"

benmens:
I had a similar issue.

For me the solution was to rename the folder "~/Library/Arduino15/packages/arduino/tools/avr-gcc" to "~/Library/Arduino15/packages/arduino/tools/avr-gcc-old". This folder contains old 32-bit binaries. After renaming this folder, arduino uses the 64-bit binaries in "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin"

Never mind. This was just a temporal fix. The folder will be recreated by Arduino automatically. I fixed this by creating a custom version of package_digistump_index.json that does not depend on the 32-bit version of avr-gcc.

You can use it by uninstalling the Digistumb AVR Boards package, replace the Digistumb boardmanagers URL with https://raw.githubusercontent.com/digistump/arduino-boards-index/master/package_digistump_index.json and install Digistumb AVR Boards again.

Hi,
I am having a similar issue but with mBlock 5.1 only, everything works fine within the arduino IDE.
Here is the error message when I try to download my simple code (a blinking led) into my Arduino Uno:

start processing code......
processing code by middleware of pinMode
avr-toolchain/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"/Applications/Makeblock/IdeServicePlus/app/external/arduino/avr-library/variants/standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" "/Users/boutelierroca/mblock-avr/temp/build/code.cpp" -o "/Users/boutelierroca/mblock-avr/temp/build/code.o"
Command failed: avr-toolchain/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"/Applications/Makeblock/IdeServicePlus/app/external/arduino/avr-library/variants/standard" -I"avr-library/cores/arduino" -I"arduino-libraries/makeblock/src" -I"arduino-libraries/makeblock/src/utility/avr" -I"avr-library/libraries/Wire/utility" -I"avr-library/libraries/Wire" -I"avr-library/libraries/SoftwareSerial" -I"arduino-libraries/arduino/WiFi/src/" -I"arduino-libraries/arduino/SD/src/" -I"arduino-libraries/arduino/Bridge/src/" -I"arduino-libraries/arduino/Temboo/src/" -I"arduino-libraries/arduino/Servo/src/" -I"arduino-libraries/arduino/Ethernet/src/" -I"arduino-libraries/arduino/TFT/src/" -I"arduino-libraries/arduino/SpacebrewYun/src/" -I"arduino-libraries/arduino/LiquidCrystal/src/" -I"arduino-libraries/arduino/GSM/src/" "/Users/boutelierroca/mblock-avr/temp/build/code.cpp" -o "/Users/boutelierroca/mblock-avr/temp/build/code.o" /bin/sh: avr-toolchain/bin/avr-g++: 
Bad CPU type in executable
Failed to compile file code.cpp
arduino build failed.

Does anyone have an idea on how to make it work with mBlock?
Thanks!

Hey guys!!

Im install this version IDE 1.8.10 "http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8976-BUILD-869-macosx.zip"

Before that error 32bits. I solved other error "Multiple libraries were found for "LiquidCrystal.h" problem by downgrading "Arduino AVR Boards" to 1.6.23

After resolving "LiquidCrystal.h" I take this error:

fork/exec /Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++: bad CPU type in executable
Error compiling for board Anet V1.0.

My Mac running 10.15.1 OSX version

Now I don't know what else to do to solve this 32bit problem.

Please could someone help me?

I think you need the very latest version of the AVR board package to work on versions of MacOS that don't support 32-bit executables.

The newest 1.8.10 has all the parts that are required inside. One simply needs to trick the Digistump config to use what is included, instead of its own old, out of date, no longer supported snowflake of the AVR tools.

I found this easy enough by simply linking the current shipping 64bit version, into the Digistump tree.

First, make sure your board includes are all setup properly. Next, shutdown the Arduino IDE completely. Finally, from a shell prompt, you are gonna move the Digistump snowflake out of the way, and link in the current shipping version:

$ cd ~/Library/Arduino15/packages/arduino/tools/avr-gcc
$ mv 4.8.1-arduino5 orig.4.8.1
$ ln -s /Applications/Arduino.app/Contents/Java/hardware/tools/avr 4.8.1-arduino5

You could just delete the old stuff I suppose. But that should cover it for you. Fire up Arduino IDE as normal and get back to work :slight_smile:

I tested this on Arduino IDE 1.8.10 running on macOS Catalina 10.15

Cheers
Anjin

1 Like

The solution may depend on which board you have selected from the Arduino IDE's Tools > Board menu when you get the error. If you're using one of the official Arduino AVR Boards (e.g. Uno, Mega, Leonardo, etc.), then the fix should be simply updating Arduino AVR Boards. If you're using a different board, then the fix might be more complicated if the hardware package of that board has not had a new release with the 64 bit version of the toolchain yet.

If you'll tell me which board you're having trouble with, I can provide detailed instructions.

Hi pert,

in my case it's the SPI lib with my Leonardo board..

Using library SPI at version 1.0 in folder: /Users/arne/Library/Arduino15/packages/arduino/hardware/avr/1.8.2/libraries/SPI
fork/exec /Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags: bad CPU type in executable
Error compiling for board Arduino Leonardo.

Best Regards,

Arne (Latest IDE 1.8.9 on iMAC)

Update to 1.8.10 and latest version of official avr board package. Both of those must be updated for you, not just the ide.

Nothing will compile for you right now, nothing specific to board or library. You updated mac os, and the new version doesnt run 32-bit applications, only 64-bit ones. And until the latest version, the compiler toolchain was 32-bit.

AnjinMeili:
The newest 1.8.10 has all the parts that are required inside. One simply needs to trick the Digistump config to whatuse is included, instead of its own old, out of date, no longer supported snowflake of the AVR tools.

I found this easy enough by simply linking the current shipping 64bit version, into the Digistump tree.

First, make sure your board includes are all setup properly. Next, shutdown the Arduino IDE completely. Finally, from a shell prompt, you are gonna move the Digistump snowflake out of the way, and link in the current shipping version:

$ cd ~/Library/Arduino15/packages/arduino/tools/avr-gcc
$ mv 4.8.1-arduino5 orig.4.8.1
$ ln -s /Applications/Arduino.app/Contents/Java/hardware/tools/avr 4.8.1-arduino5

You could just delete the old stuff I suppose. But that should cover it for you. Fire up Arduino IDE as normal and get back to work :slight_smile:

I tested this on Arduino IDE 1.8.10 running on macOS Catalina 10.15

Cheers
Anjin

Was trying forever to do a Digispark kickstart, came up with same message. Then i managed to mess up IDE when I tried to do the shell thing.

managed to work out how to remove IDE and various files to do a clean (ish) install, followed these instructions and voila - I think it is working. Thanks very much I had just got into Arduino , it had made me lose interest. So am happy. Total noob btw.Thankyou Anjin ........... catalina 10.15.2 and IDE 1.8.10

Oh I found out I did not need those $ and I pasted each line in seperately.

AnjinMeili:
...move the Digistump snowflake out of the way, and link in the current shipping version:

$ cd ~/Library/Arduino15/packages/arduino/tools/avr-gcc
$ mv 4.8.1-arduino5 orig.4.8.1
$ ln -s /Applications/Arduino.app/Contents/Java/hardware/tools/avr 4.8.1-arduino5

Thanks Anjin, this worked for me. It got things verifying/compiling, at least. Thank you!

(Next challenge for me is to figure out why the device search times out)

1 Like

I have similar problem, BUT, I deleted the directory while working on another problem.
I have two directories:

4.9.2-atmel3.5.4-arduino2 7.3.0-atmel3.6.1-arduino5

How can I get arduino IDE to compile for UNO or Nano, it still compiles for attiny and esp32 boards???

UPDATE: I tried what @AnjinMeili suggested on page 1, only I substituted my file/directory name (7.3.0-atmet3.6.1-arduino5).

Opened Arduino, tools, board manager. AVR came up and had UPDATE, I hit UPDATE. Fixed!!! Many thanks.

Gielk:
Solution is download the latest build here Mass update bundled resources by facchinm · Pull Request #8976 · arduino/Arduino · GitHub

voor mac hier http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8976-BUILD-869-macosx.zip

can you please tell me how to download it from github?? I went to the link but what am I supposed to do after that??

I'm running IDE 1.8.13 on MacOS 10.15.7 and this is still an issue for me for the Intel Galileo (rev2) board. For the basic template sketch I get:

fork/exec /Users/dad/Library/Arduino15/packages/Intel/tools/i586-poky-linux-uclibc/1.6.2+1.0/i586/pokysdk/usr/bin/i586-poky-linux-uclibc/i586-poky-linux-uclibc-g++: bad CPU type in executable
Error compiling for board Intel® Galileo Gen2.

If I select the Uno board instead, the compile is clean. Could it be the files for the Galileo board have not been updated to 64b?

Thx.