Unable to link using libm.a and libc.a

"Sean" <[email protected]>
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
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

\lib\libcrc.a C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a -o
C:\Arduino\Arduino_Ada\BMP085\main.elf

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'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-int_img.o):
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'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-int_img.o):
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'

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

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

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-int_img.o):
In function `avr__int_img__u8_img_99_right':

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

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-int_img.o):
In function `avr__int_img__u16_div_10':

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

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__julian_day':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:86: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:89: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:91: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:91: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:87: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:90: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:90: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__julian_date':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:106: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:106: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:106: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:107: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:107: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:107: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:108: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:108: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:108: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:109: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__hour':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:163: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:163: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__minute':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:170: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:170: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:170: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
:C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:182: more undefined
references to `__divmodsi4' follow

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__sub_second':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:183: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__second':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:176: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:176: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__seconds_of':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:220: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:220: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:220: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__split':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:243: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:244: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:246: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:248: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__day_of_week':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:127: undefined reference
to `__divmodsi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__seconds_of':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:220: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:220: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:220: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__time_of':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:306: undefined reference
to `__divmodqi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__microseconds':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:417: undefined reference
to `__divmodhi4'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__seconds__2':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:429: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__minutes':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:435: undefined reference
to `__mulsi3'

C:\avr-ada-1.2.0_bin\avr\avr_lib\atmega328p\lib\libavrada.a(avr-real_time.o)
: In function `avr__real_time__hours':

C:\avr-ada-1.2.0_bin\avr\avr_lib/avr-real_time.adb:441: undefined reference
to `__mulsi3'

collect2: ld returned 1 exit status

avr-gnatlink: error when calling C:\GNAT\2012\bin\avr-gcc.exe

avr-gnatmake: *** link failed.

make: *** [avr_all] Error 4

 

C:\Arduino\Arduino_Ada\BMP085>

C:\Arduino\Arduino_Ada\BMP085>

_______________________________________________
AVR-GCC-list mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list
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.