[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Unable to link using libm.a and libc.a

From: Rolf Ebert
Subject: Re: [avr-gcc-list] Unable to link using libm.a and libc.a
Date: Sat, 13 Apr 2013 10:46:10 +0200
User-agent: Mozilla/5.0 (Windows NT 6.2; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

Am 13.04.2013 07:49, schrieb Sean:
I’ve been attempting to compile and link an Ada programme for the Arduino.

You obviously managed to master the most difficult part, that is building the Ada cross compiler.

I have managed to get a simple programme compiled linked and running on
an AtMega328p board.


But when I start to use some of the more complex functions I obviously
had to start using avrlibc.

Yes, all gcc compiled programs - independent of the source language - use the builtin functions from libgcc.a. AVR-Ada only rarely uses functions from AVR-LibC explicitely.

I’ve down loaded and built avrlibc and I have then attempted to link my

But no matter how I try to tell the compiler/linker to use libc or libm
I keep getting link issues:

avr-gnatbind --RTS=C:\GNAT\2012\lib\gcc\avr\4.5.4\rts-zfp -nostdlib -I-
-x C:\Arduino\Arduino_Ada\BMP085\obj\main.ali

avr-gnatlink C:\Arduino\Arduino_Ada\BMP085\obj\main.ali
C:\Arduino\Arduino_Ada\BMP085\\obj\crtm328p._o -nostdlib -lgcc -lc -lm
-mavr5 -Tdata=0x00800200 -mmcu=avr5 -g -nostdlib
C:\avr-ada-1.2.0_bin\avr\debug\lib\libdebug.a C:\avr-ada-1.2.0_bin\avr\crc

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a -o

C:\avr-ada-1.2.0_bin\avr\onewire\lib\libonewire.a(one_wire-search.o): In
function `one_wire__search__verify':

C:\avr-ada-1.2.0_bin\avr\onewire/one_wire-search.adb:238: undefined
reference to `memcmp'

In function `avr__int_img__u8_img_c':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-int_img.adb:82: undefined reference
to `itoa'

This is a function from AVR-LibC

In function `avr__int_img__u8_img_right':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-int_img.adb:98: undefined reference
to `__udivmodqi4'

This is a function from libgcc

The linker neither finds the libc nor the libgcc functions. You have a problem with your installation. Did you specify the same PREFIX for your avr-gcc and avr-libc installation?

Try a simple C program first.

It might be that you mix the Ada compiler from AdaCore (installed in C:\GNAT\2012) with AVR-Ada. AVR-Ada relies on its own run time system (RTS). Except for Ada tagged types the AVR-Ada RTS is more capable than the one from AdaCore.

You might get better help at the avr-ada-devel mailing list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]