Re: Unable to link using libm.a and libc.a

Georg-Johann Lay <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
Sean schrieb:
> I've been attempting to compile and link an Ada programme for the 
> Arduino.
> 
> 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.
> 
> I've down loaded and built avrlibc and I have then attempted to link 
> my programme.  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\onewire\lib\libonewire.a 
> C:\avr-ada-1.2.0_bin\avr\debug\lib\libdebug.a 
> C:\avr-ada-1.2.0_bin\avr\crc

Why are you -nostdlib? The missing functions below are standard 
functions from libc / libgcc.


> [...] undefined reference to `memcmp'
> [...] undefined reference to `itoa'
> [...] undefined reference to `__udivmodqi4'
> [...] undefined reference to `__udivmodhi4'
> [...] many more

Also make sure that the libraries are fitting the compiler version, see 
the 4.7 release notes.

http://gcc.gnu.org/gcc-4.7/changes.html

Johann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.