Installing Arduino (023 and 1.0) on Linux -stupid errors- can't compile anything

(1/2) > >>

laurentp:
Hi,
I am trying to install Arduino (probably 023 but same with 1.0) for MultiWii project on Linux.
I have COMPILED (not installed from packages):
- binutils 2.21.1
- gcc 4.6.2 with c and c++
- avr-libc 1.8.0

now I downloaded and unpacked Arduino package. OK,
but trying to build even "bareminimum" gives errors (023):

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

with 1.0 errors are different:

/home/laurent/Desktop/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
/home/laurent/Desktop/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:44:9: error: 'prog_char' does not name a type
/home/laurent/Desktop/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:47:23: error: 'p' was not declared in this scope

I CAN compile examples shipped with avr-libc.
everything for avr is installed in /usr/avr/*

Any ideas? [what is my stupid error?]

tmonteit:
This is terrible.   I am having the exact same issue.    Examples should work out of the box without library issues.    Is there a fix for this?

SurferTim:
I know this bug. This is caused by a "#define round" macro that was in wiring.h in V0022.
Quote

In file included from /usr/avr/lib/gcc/avr/4.6.2/../../../../avr/include/util/delay.h:44:0,
                 from /usr/avr/lib/gcc/avr/4.6.2/../../../../avr/include/avr/delay.h:37,
                 from /home/laurent/Desktop/Arduino_023/hardware/arduino/cores/arduino/wiring_private.h:30,
                 from /home/laurent/Desktop/Arduino_023/hardware/arduino/cores/arduino/WInterrupts.c:34:
/usr/avr/lib/gcc/avr/4.6.2/../../../../avr/include/math.h:426:15: error: expected identifier or '(' before 'double'
/usr/avr/lib/gcc/avr/4.6.2/../../../../avr/include/math.h:426:15: error: expected ')' before '>=' token
Look in
/home/laurent/Desktop/Arduino_023/hardware/arduino/cores/arduino/wiring_private.h:30,
and check for a "#define round" macro and comment it out. It is trying to replace the round function in math.h at line 426.
 

laurentp:
Great, it worked (at least for "bareminimum")...
EDIT: MultiWii compiles too,thanks.

With a small correction: i have found that macro in wiring.h not in wiring_private.h.

SurferTim:
Quote from: laurentp on January 16, 2012, 03:18:46 am

With a small correction: i have found that macro in wiring.h not in wiring_private.h.
Oops. My bad. I thought wiring.h disappeared in V0023, but I guess it disappeared in V1.0.
I skipped V0023 altogether. I'm using v0022 and testing v1.0 now. :)

That bug was due to a change in the avr-libc delay function. Starting with avr-libc v1.7.1 and later (yours is 1.8.0), delay.h requires "#include <math.h>" to correct a timing error in the delay() functions. The "#define round" was for earlier versions of avr-libc to apparently correct an error in those versions.

I haven't ran into that print error in V1.0 (yet).

Navigation

[0] Message Index

[#] Next page