[SOLVED] Unable to compile anything, AS: Invalid Argument

I cannot compile anything with Arduino 1.6.14 on Debian Jessie. The error message I get is:

as: unrecognized option '-mmcu=avr5'
exit status 1
Error compiling for board Arduino/Genuino Uno.

I know this is because avr assembler does not support the "-mmcu=" option but I do not know how to fix this?

Danois90:
I know this is because avr assembler does not support the "-mmcu=" option

Extract from as --help output:

AVR Assembler options:
  -mmcu=[avr-name] select microcontroller variant
                   [avr-name] can be:
                   avr5  - enhanced AVR core with up to 64K program memory

Usually I would expect to see something like -mmcu=atmega328p, not avr5 but I'm not really familiar with as. Please do this:

  • File > Preferences > Show verbose output during: compilation(check) > OK
  • Sketch > Compile/Verify
  • After compilation fails click the "Copy error messages" button on the right side of the orange bar.
  • Paste the output here using code tags(</> button on the toolbar).

Using the hourly build can be problematic at times. Have you tried using the latest Arduino IDE release, 1.6.13 to check if the issue is isolated to the hourly build?

Sorry, I didn't see the second page of the assemblers output where the -mmcu option is described. Here is the verbose output of the verification of an empty script:

Arduino: 1.6.14 Hourly Build 2016/11/28 04:26 (Linux), Board: "Arduino/Genuino Uno"

/home/tnb/Dokumenter/arduino/arduino-builder -dump-prefs -logger=machine -hardware /home/tnb/Dokumenter/arduino/hardware -tools /home/tnb/Dokumenter/arduino/tools-builder -tools /home/tnb/Dokumenter/arduino/hardware/tools/avr -built-in-libraries /home/tnb/Dokumenter/arduino/libraries -libraries /home/tnb/Arduino/libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10614 -build-path /tmp/arduino_build_337502 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/home/tnb/Dokumenter/arduino/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/home/tnb/Dokumenter/arduino/hardware/tools/avr -verbose /tmp/untitled1739663348.tmp/sketch_dec05a/sketch_dec05a.ino
/home/tnb/Dokumenter/arduino/arduino-builder -compile -logger=machine -hardware /home/tnb/Dokumenter/arduino/hardware -tools /home/tnb/Dokumenter/arduino/tools-builder -tools /home/tnb/Dokumenter/arduino/hardware/tools/avr -built-in-libraries /home/tnb/Dokumenter/arduino/libraries -libraries /home/tnb/Arduino/libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10614 -build-path /tmp/arduino_build_337502 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/home/tnb/Dokumenter/arduino/hardware/tools/avr -prefs=runtime.tools.avrdude.path=/home/tnb/Dokumenter/arduino/hardware/tools/avr -verbose /tmp/untitled1739663348.tmp/sketch_dec05a/sketch_dec05a.ino
Using board 'uno' from platform in folder: /home/tnb/Dokumenter/arduino/hardware/arduino/avr
Using core 'arduino' from platform in folder: /home/tnb/Dokumenter/arduino/hardware/arduino/avr
Detecting libraries used...
"/home/tnb/Dokumenter/arduino/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10614 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/tnb/Dokumenter/arduino/hardware/arduino/avr/cores/arduino" "-I/home/tnb/Dokumenter/arduino/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_337502/sketch/sketch_dec05a.ino.cpp" -o "/dev/null"
Generating function prototypes...
"/home/tnb/Dokumenter/arduino/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10614 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/tnb/Dokumenter/arduino/hardware/arduino/avr/cores/arduino" "-I/home/tnb/Dokumenter/arduino/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_337502/sketch/sketch_dec05a.ino.cpp" -o "/tmp/arduino_build_337502/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/tnb/Dokumenter/arduino/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_337502/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/home/tnb/Dokumenter/arduino/hardware/tools/avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10614 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/home/tnb/Dokumenter/arduino/hardware/arduino/avr/cores/arduino" "-I/home/tnb/Dokumenter/arduino/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_337502/sketch/sketch_dec05a.ino.cpp" -o "/tmp/arduino_build_337502/sketch/sketch_dec05a.ino.cpp.o"
as: ukendt flag '-mmcu=avr5'
exit status 1
Error compiling for board Arduino/Genuino Uno.

So.. Still no help to solve this.. I've tried to install Arduino from repo, version 1.0.5 (avr-g++ version 4.8.1) which actually compiles OK, but it will not recognize any serial ports and any attempt to upload a sketch produces the following error:

Binær sketch størrelse: 1.056 bytes (af en 32.256 byte maksimum)
processing.app.SerialNotFoundException: Serial port 'COM1' ikke fundet. Valgte du den rigtige i Tools > Serial Port menuen?
	at processing.app.Serial.<init>(Serial.java:191)
	at processing.app.Serial.<init>(Serial.java:77)
	at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77)
	at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:175)
	at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67)
	at processing.app.Sketch.upload(Sketch.java:1671)
	at processing.app.Sketch.exportApplet(Sketch.java:1627)
	at processing.app.Sketch.exportApplet(Sketch.java:1599)
	at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
	at java.lang.Thread.run(Thread.java:745)

The translation is "serial port COM1 not found" and then a suggestion to select the correct port in Tools -> Serial port - but this menu item is disabled :frowning:

Really frustrating that one version will not compile, the other will not upload.. What to do from here? Is it possible to let the new version of Arduino (1.6.14 with avr-g++ version 4.9.2) use the old compiler somehow?

Danois90:
So.. Still no help to solve this.. I've tried to install Arduino from rIs it possible to let the new version of Arduino (1.6.14 with avr-g++ version 4.9.2) use the old compiler somehow?

This will give you Arduino IDE 1.6.14 with avr-gcc 4.8.1:

  • Tools > Board > Boards Manager...
  • Wait for downloads to complete.
  • Click on "Arduino AVR Boards".
  • Select 1.6.9 from the "Select version" drop down menu.
  • Click "Install".
  • Wait for installation to complete.
  • Click "Close".
1 Like

Thanks alot! I did as you said, and then it compiled - but upload failed. Then I added my user account to tty and dialout (as described in the troubleshooting section), and now it works! Looking forward to a nerdy X-mas :slight_smile:

1 Like

pert:
This will give you Arduino IDE 1.6.14 with avr-gcc 4.8.1:

  • Tools > Board > Boards Manager...
  • Wait for downloads to complete.
  • Click on "Arduino AVR Boards".
  • Select 1.6.9 from the "Select version" drop down menu.
  • Click "Install".
  • Wait for installation to complete.
  • Click "Close".

Absolute GENIUS ! thanks LOADS MAN !!! after a few weeks putting off making sketches it was like using a mouse that doesnt have left or right click LOL

This i the first thing im gonna check from now on lol

I know this is an old post but the solution was valid, thank you immensely !!!

1 Like

I'm glad it was helpful. It's unfortunate if you are forced to use the old version of Arduino AVR Boards though. That version worked fine of course but there have been some minor improvements since then due to the new tool versions (most especially LTO).

Maybe if you would take a minute to give some information on the problem you had it could help to find a solution so that you don't need to always be stuck using an old Arduino AVR Boards version.