Package: arduino-core
Version: 0022+dfsg-3
Severity: important

*** Please type your report below this line ***

The newest version of avr-libc in Debian has broken compiling with
arduino-core (and probably arduino as well).  avr-libc 1.7.1 shipped
with a bug in the delay.h header because it did not include math.h
rendering any program which doesn't include math.h before the
util/delay.h header uncompilable.   I will report this bug against
avr-libc 1.7.1-1 in order to have this fixed, but 1.7.1 also
introduces another bug when using the wiring.h library included in
Arduino, because math.h includes a definition of round which conflicts
with the wiring.h declaration at line 74 of
/usr/share/arduino/hardware/arduino/cores/arduino/wiring.h

The bug manifests itself initially as a compliation error and can be
reproduced through:

mkdir ~/tmp_arduino_bug
cd ~/tmp_arduino_bug
cat > Makefile <<'!====EOF====!'
ARDUINO_DIR = /usr/share/arduino

TARGET       = Blink
#ARDUINO_LIBS = LiquidCrystal

MCU          = atmega168
F_CPU        = 16000000
ARDUINO_PORT = /dev/ttyUSB*

AVRDUDE_ARD_PROGRAMMER = arduino
AVRDUDE_ARD_BAUDRATE   = 57600
#AVRDUDE_ARD_EXTRAOPTS  = -F

include /usr/share/arduino/Arduino.mk
!====EOF====!
cp /usr/share/arduino/examples/1.Basics/Blink/Blink.pde .
make

which produces this output on unstable:
/usr/share/arduino/Arduino.mk:405: build-cli/depends.mk: No such file
or directory
mkdir build-cli
echo \#include \"WProgram.h\" > build-cli/Blink.cpp
cat  Blink.pde >> build-cli/Blink.cpp
/usr/bin/avr-g++ -MM -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -f
cat build-cli/Blink.d > build-cli/depends.mk
rm build-cli/Blink.cpp
echo \#include \"WProgram.h\" > build-cli/Blink.cpp
cat  Blink.pde >> build-cli/Blink.cpp
/usr/bin/avr-g++ -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -fn
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-gcc -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -st
/usr/bin/avr-g++ -c -mmcu=atmega168 -DF_CPU=16000000 -I.
-I/usr/share/arduino/hardware/arduino/cores/arduino  -g -Os -w -Wall
-ffunction-sections -fdata-sections -fn
In file included from
/usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37:0,
                 from
/usr/share/arduino/hardware/arduino/cores/arduino/wiring_private.h:30,
                 from
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:28:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function
‘void _delay_ms(double)’:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:149:42:
error: ‘fabs’ was not declared in this scope
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:149:43:
error: ‘ceil’ was not declared in this scope
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function
‘void _delay_us(double)’:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:226:42:
error: ‘fabs’ was not declared in this scope
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:226:43:
error: ‘ceil’ was not declared in this scope
make: *** [build-cli/HardwareSerial.o] Error 1

After fixing the bug in avr-libc, the error changes to:

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

which is caused by the macro definition of round() in wiring.h:
#define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

commenting out this line fixes this final compliation error and the
program compiles, uploads and correctly works on the Arduino that I
have.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.39-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages arduino-core depends on:
ii  avr-libc                      1:1.7.1-1  Standard C library for Atmel AVR d
ii  avrdude                       5.10-3     software for programming Atmel AVR
ii  gcc                           4:4.6.1-2  GNU C compiler
ii  gcc-avr                       1:4.5.3-1  The GNU C compiler (cross compiler

arduino-core recommends no packages.

arduino-core suggests no packages.

-- no debconf information

Michael Janssen --- Jamuraa --- jamu...@base0.net --- jamu...@debian.org



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to