Arduino 1.8+ on Ubuntu 16.04LTS gives "/avr/bin/as': execv: Exec format error"

Hi All,

I have used Arduino 1.6 series for some small projects in the last couple of months without problems. The last one is 1.6.13 which I use presently. A few days ago I realized that versions 1.8.0 and 1.8.2 are already available. I decided trying them, but I ran into trouble. The version 1.8.0 and 1.8.2 shows the same: even compiling the empty project (new sketch) fails with the following error message:

avr-g++: error trying to exec '/home/szilva/Downloads/arduino-1.8.2/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/as': execv: Exec format error
exit status 1
Error compiling for board Arduino/Genuino Uno.

All versions are extracted in my download folder (of course in separate subfolders named by versions), nothing was "installed". I simply run "./arduino" from the selected version's folder in a terminal, or do the same with a shortcut on my desktop.

Reading threads about the same error but with versions 1.6.x I found that maybe something wrong in my home folder, that's why I created a brand new test user, and tried Arduinos from its profile without success, 1.8.x versions give the same error message.

My system is an Ubuntu 16.04LTS, 64 bit installation.

Is there any idea, what should I do in order to use newer versions of Arduino?

Thanks,
Zoltan

I do the same, just unzip the huge zip file into it's own folder at the C: level, and run Arduino.exe from there. I think it's up to 1.8.3 now even. I'm always several versions behind, preferring to see how the latest settles out.

Also takes me a while to get new board types reinstalled from Minicore, Mightycore, etc.
Would be nice if we could just set those up like the /libraries folder and have the IDE pull them in.

OMG, it was my fault...

I took a closer look at the error message with switched on the verbose compiling output. I searched the directory where the named 'as' lays, and found that all files in this directory are zero byte long!

It turned out, that files were corrupted by DoubleCommander's builtin extractor. If I extract the same .tar.xz package with command line tar, the files have normal, non-zero lengths. So the compiling is working fine too.

I cannot imagine, what DC's extractor really did with the package, as it did't tell any warnings or errors during extracting...

Thanks for the heads up on this problem. I run Linux Mint and had tried to help another person with the same problem without finding anything.

szilvasyz:
I cannot imagine, what DC's extractor really did with the package, as it did't tell any warnings or errors during extracting...

It does not handle hard links in tar files properly. Instead of creating a new link to an existing file it just creates an empty file.
All files in tools/avr/avr/bin are hard links to files stored earlier in the archive.

>> tar tvf arduino-1.8.2-linux64.tar.xz | grep 'link to'
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:21 arduino-1.8.2/hardware/tools/avr/bin/avr-gcc link to arduino-1.8.2/hardware/tools/avr/bin/avr-gcc-4.9.2
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/bin/avr-ld link to arduino-1.8.2/hardware/tools/avr/bin/avr-ld.bfd
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:21 arduino-1.8.2/hardware/tools/avr/bin/avr-c++ link to arduino-1.8.2/hardware/tools/avr/bin/avr-g++
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/ld.bfd link to arduino-1.8.2/hardware/tools/avr/bin/avr-ld.bfd
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/readelf link to arduino-1.8.2/hardware/tools/avr/bin/avr-readelf
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/as link to arduino-1.8.2/hardware/tools/avr/bin/avr-as
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/objcopy link to arduino-1.8.2/hardware/tools/avr/bin/avr-objcopy
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/ar link to arduino-1.8.2/hardware/tools/avr/bin/avr-ar
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/ld link to arduino-1.8.2/hardware/tools/avr/bin/avr-ld.bfd
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/ranlib link to arduino-1.8.2/hardware/tools/avr/bin/avr-ranlib
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/nm link to arduino-1.8.2/hardware/tools/avr/bin/avr-nm
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/objdump link to arduino-1.8.2/hardware/tools/avr/bin/avr-objdump
hrwxr-xr-x jenkins/jenkins       0 2016-12-05 17:03 arduino-1.8.2/hardware/tools/avr/avr/bin/strip link to arduino-1.8.2/hardware/tools/avr/bin/avr-strip

Hi Zoltan,

thanks for finding this out!!!!!
i had the same problem for a long long time now....
and also with my last try after a fresh installation of Kubuntu 17.04 and Arduino IDE 1.8.3 -
also because i use DoubleCommander.
and there are other reports of this error message - i will link theme here so they are better found by search engines:

Ubuntu 16.04 compilation of empty projects fails
IDE 1.6.6 on Kubuntu 15.10 64bit 'avr-gcc: exec format error Error compiling.'

thanks oqibidipo for finding the real problem!
will check if this bug is reported.

with

$ tar xf arduino-1.8.3-linux64.tar.xz

from the command line to extract the downloaded file it worked :slight_smile:

sunny greetings stefan