Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Dec 2011 12:56:39 GMT
From:      bob frazier <bobf@mrp3.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/163562: avr-libc will not compile when using util/delay.h
Message-ID:  <201112231256.pBNCud3Y034554@red.freebsd.org>
Resent-Message-ID: <201112231300.pBND0Pvx031219@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         163562
>Category:       ports
>Synopsis:       avr-libc will not compile when using util/delay.h
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 23 13:00:24 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     bob frazier
>Release:        7.4-STABLE
>Organization:
S.F.T. Inc.
>Environment:
FreeBSD BSDSilver.SFT.local 7.4-STABLE FreeBSD 7.4-STABLE #15: Thu Dec 15 19:14:22 PST 2011     root@BSDSilver.SFT.local:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
attempting to build code for avr using avr-gcc and avr-libc (arduino build environment).  Code that makes use of 'delay' causes several compile errors, similar to the following:

/usr/local/lib/gcc/avr/4.3.4/../../../../avr/include/util/delay.h:149: error: 'fabs' was not declared in this scope 

the problem and a workable solution are both described here
http://code.google.com/p/arduino/issues/detail?id=604

the attached patch file resolves this issue.

>How-To-Repeat:
install latest avr-libc and arduino build environment and attempt to build the 'blink' sample.

>Fix:
see attached patch file, that adds #include <math.h> to /usr/local/avr/include/util/delay.h



Patch attached with submission follows:

--- include/util/delay.h.in.orig	2010-11-09 11:39:32.000000000 -0800
+++ include/util/delay.h.in	2011-12-23 04:40:40.000000000 -0800
@@ -37,10 +37,13 @@
 
 #ifndef __HAS_DELAY_CYCLES
 #define __HAS_DELAY_CYCLES @HAS_DELAY_CYCLES@
 #endif
 
+// patch recommended by http://code.google.com/p/arduino/issues/detail?id=604
+#include <math.h>
+// end patch
 #include <inttypes.h>
 #include <util/delay_basic.h>
 
 /** \file */
 /** \defgroup util_delay <util/delay.h>: Convenience functions for busy-wait delay loops


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112231256.pBNCud3Y034554>