Unable to compile any code - gcc avr error

I'm running Antergos Linux (a derivative of Arch Linux) and installed the Arduino IDE via the arduino package from the AUR. When I try to compile ANY code (even a blank sketch), I get the following error.

/usr/share/arduino/hardware/tools/avr/lib/avr/bin/ld: cannot find -lm

It seems that the Arduino IDE comes with its own tool suite, which includes gcc avr. I can't find another post that shares this kind of error.

I'm at a loss to correct this problem; I tried installing the beta version of arduino from the AUR (arduino-beta) to get version 1.5.5 of the IDE, but I get the same error when compiling.

Any help would be appreciated.

lib m is part of avr-libc, perhaps you need to install avr-libc separately.
You could also try the tarball (.tgz) package from the Arduino downloads area. It contains everything but a java runtime and will coexist with your package install. Just unzip it in your home dir and run the arduino script.

Thanks for the reply. For documentation purposes, I would like to report that I found a solution elsewhere on the internet. The following solution was posted on the arduino package page on the Arch Linux AUR.

The following patch solves the

/usr/share/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../avr/bin/ld: cannot find -lm


Replace the following part in PKGBUILD

package() {
cd "$srcdir/arduino-$pkgver"

# arduino excutable should accept arguments


package() {
cd "$srcdir/arduino-$pkgver"
# remove the provided avr-gcc tool chain, cause
# we will use the one provided by Arch
rm -r hardware/tools

# arduino excutable should accept arguments

The arduino IDE will now use the avr-g++ that comes as a makedependency of avr-libc.

Probably also a good idea to list avr-gcc as a proper dependency.

Why this works is explained by the file:


in the original archive.

Honestly, this solution seems a little buggy to me, but oh well.