Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#633660: arduino-core: Broken with avr-libc 1.7.1

26 views
Skip to first unread message

Michael Janssen

unread,
Jul 12, 2011, 11:50:02 AM7/12/11
to
Package: arduino-core
Version: 0022+dfsg-3
Severity: important


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

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the named addressee, you should not disseminate, distribute or copy this email. Please notify the sender immediately by email if you have received this email by mistake and delete this email from your system. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

Within the United States, sale of the Recon Scout to non-Federal and non-military entities is limited to state and local police and firefighters eligible for licensing under 47 C.F.R. § 90.20(a)(1) of the FCC Rules, and security personnel in Critical Infrastructure Industries as defined in the FCC Rules, 47 C.F.R. § 90.7. Operation of this product by non-federal and non-military entities requires an FCC license. These FCC Rules do not apply to sales made outside the United States.

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

0 new messages