avr-gcc does not find crtm128.o and libm.a at standart place

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
# pwd
/usr/avr/lib/avr5
# ls -l|grep "128\|lib"
-rw-r--r-- 1 root root   3032 2008-01-28 23:23 crtm128.o
-rw-r--r-- 1 root root 182928 2008-01-28 23:23 libc.a
-rw-r--r-- 1 root root  43780 2008-01-28 23:23 libm.a
# cd /path/to/project
# make
Linking: talker.elf
avr-gcc -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=11059200UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=bitarray.o  -std=gnu99 -MD -MP -MF .dep/talker.elf.d bitarray.o buffer.o cards.o hardware.o host.o main.o mode.o noiser.o slip.o spi.o timer0.o timer1.o uart2.o --output talker.elf -Wl,-Map=talker.map,--cref    -lm
/usr/lib/gcc/avr/4.5.1/../../../../avr/bin/ld: crtm128.o: No such file: No such file or directory
collect2: ld returned 1 exit status

I do strace and found out than crtm128 is searched only in current directory. if I place crtm128 to current directory:

#make
Linking: talker.elf
avr-gcc -mmcu=atmega128 -I. -gdwarf-2 -DF_CPU=11059200UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=bitarray.o  -std=gnu99 -MD -MP -MF .dep/talker.elf.d bitarray.o buffer.o cards.o hardware.o host.o main.o mode.o noiser.o slip.o spi.o timer0.o timer1.o uart2.o --output talker.elf -Wl,-Map=talker.map,--cref    -lm
/usr/lib/gcc/avr/4.5.1/../../../../avr/bin/ld: skipping incompatible /usr/lib/gcc/avr/4.5.1/../../../../avr/lib/libm.a when searching for -lm
/usr/lib/gcc/avr/4.5.1/../../../../avr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where did you get your toolchain? If this a Debian based distro (including Ubuntu) that can accept .deb's then consider getting the latest from:

www.wrightflyer.co.uk/avr-gcc/

That simply works (as long as you follow the advice about adding /usr/local/avr/bin to the PATH)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My toolchain I build via script from SlackBuilds.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well either get the .deb or read the sticky thread at the top of this forum that has a build script that simply works (as is seen in those .deb's on my website as Bingo uses his own script to build them)