Strange errors in math.h when trying to compile a project

Hi everyone.

I'm trying to build the firmware for my 3D-printer. The firmware is the file SprinterFor5to1Extruder.zip and can be found here: http://makergear.googlegroups.com/attach/b118cc03144d17a8/SprinterFor5to1Extruder.zip?part=4

This firmware is known to require "Arduino 0023" in order to compile, which is what I'm using. First I got this to compile fine on a Windows XP machine (using Arduino 0023), no problems. However I need this to work on my GNU/Linux system.

I open the Sprinter.pde file and hit "verify". Then I quickly get the following errors:

In file included from /usr/lib64/gcc/avr/4.5.3/../../../../avr/include/util/delay.h:44:0,
                 from /usr/lib64/gcc/avr/4.5.3/../../../../avr/include/avr/delay.h:37,
                 from /opt/arduino/hardware/arduino/cores/arduino/wiring_private.h:30,
                 from /opt/arduino/hardware/arduino/cores/arduino/WInterrupts.c:34:
/usr/lib64/gcc/avr/4.5.3/../../../../avr/include/math.h:426:15: error: expected identifier or '(' before 'double'
/usr/lib64/gcc/avr/4.5.3/../../../../avr/include/math.h:426:15: error: expected ')' before '>=' token

I'm using binutils-2.21.1, gcc-core-4.5.3, gcc-g++-4.5.3, avr-libc-1.8.0. My GNU/Linux system is 64-bit Slackware 13.37. I have no known issues with the system itself.

The error doesn't seem to be related to the firmware, but rather to some issue with the Arduino build environment. I'm assuming math.h is pretty common to include and since the compiler fails on that file and not the source code in the actual firmware, I'm guessing this is somehow build environment related?

After some searching I added #undef round to math.h just before round was defined. That gave me a new set of errors:

/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:92:15: error: attempt to use poisoned "SIG_USART0_RECV"
/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:145:15: error: attempt to use poisoned "SIG_USART1_RECV"
/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:155:15: error: attempt to use poisoned "SIG_USART2_RECV"
/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:165:15: error: attempt to use poisoned "SIG_USART3_RECV"

This led me to the thread http://arduino.cc/forum/index.php/topic,92364.0.html about a similar problem. However the suggested solutions to ensure that all the USARTs are defined in iomxx0_1.h or to simply add #define AVR_LIBC_DEPRECATED_ENABLE 1 to Arduino.h do not work. The latter option is not even possible for me, as I don't have the file "Arduino.h".

Any help would be appreciated.

Board: Arduino Mega 2560.

http://code.google.com/p/arduino-tiny/issues/detail?id=29&can=1&q=Round

This is the giveaway:

/usr/lib64/gcc/avr/4.5.3/../../../../avr/include/math.h:426:15: error: expected identifier or '(' before 'double'

Line 426 is the declaration for the round function. You need to upgrade to v1.0.1 or in wiring.h: http://arduino.cc/forum/index.php/topic,124736.msg937583.html#msg937583

SurferTim: This is the giveaway:

/usr/lib64/gcc/avr/4.5.3/../../../../avr/include/math.h:426:15: error: expected identifier or '(' before 'double'

Line 426 is the declaration for the round function. You need to upgrade to v1.0.1 or in wiring.h: http://arduino.cc/forum/index.php/topic,124736.msg937583.html#msg937583

Thanks for the advice. I need to use version 0023, otherwise the firmware build is known to fail for other reasons.

I tried to follow the instructions in the link posted. This seems to have the same behavior as doing #undef round in math.h. I get the same errors as posted at the end of my original post:

/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:92:15: error: attempt to use poisoned "SIG_USART0_RECV"
/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:145:15: error: attempt to use poisoned "SIG_USART1_RECV"
/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:155:15: error: attempt to use poisoned "SIG_USART2_RECV"
/opt/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:165:15: error: attempt to use poisoned "SIG_USART3_RECV"

Same problem running Ubuntu 13 64bit.

Wondering if it's a 64bit issue? Did you ever resolve it?

gdville: Same problem...

There are two issues described above.