Problems on avr-libc

I am new to OpenSUSE(from Ubuntu), and I met many problems when trying to compile the avr-libc on my notebook.
After googling a lot, I think what I should do is to compile binutils, gcc-core and avr-libc successively. But problems arose when I tried to compile binutils for avr.


tar -xjvf binutils-2.23.1.tar.bz2
cd binutils-2.23.1/
mkdir avr
cd avr
../configure --target=avr --prefix=/usr/local/avr/
make

after I using the above commands, I finally got this result:


gcc -DHAVE_CONFIG_H -I. -I../../binutils  -I. -I../../binutils -I../bfd -I../../binutils/../bfd -I../../binutils/../include -DLOCALEDIR="\"/usr/local/avr/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT size.o -MD -MP -MF .deps/size.Tpo -c -o size.o ../../binutils/size.c
mv -f .deps/size.Tpo .deps/size.Po
gcc -DHAVE_CONFIG_H -I. -I../../binutils  -I. -I../../binutils -I../bfd -I../../binutils/../bfd -I../../binutils/../include -DLOCALEDIR="\"/usr/local/avr/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT bucomm.o -MD -MP -MF .deps/bucomm.Tpo -c -o bucomm.o ../../binutils/bucomm.c
../../binutils/bucomm.c: In function ‘set_default_bfd_target’:
../../binutils/bucomm.c:159:24: error: ‘TARGET’ undeclared (first use in this function)
../../binutils/bucomm.c:159:24: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [bucomm.o] Error 1
make[4]: Leaving directory `/mnt/Downloads/Downloads/binutils-2.23.1/avr/binutils'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/mnt/Downloads/Downloads/binutils-2.23.1/avr/binutils'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/mnt/Downloads/Downloads/binutils-2.23.1/avr/binutils'
make[1]: *** [all-binutils] Error 2
make[1]: Leaving directory `/mnt/Downloads/Downloads/binutils-2.23.1/avr'
make: *** [all] Error 2

How can I solve it? I have been confused for days, so please help.
I am using OpenSUSE12.2, 64bit, and, as you can see, I am compilng binutils of version 2.23.1.

On 01/26/2013 05:26 PM, dawnos wrote:
> I am compilng binutils of version 2.23.1.

why? i ask because i think 12.2 is born with binutils 2.22, does it
miss something you must have?

and avr-libc is ready to install from
http://software.opensuse.org/package/avr-libc

hth!

btw: -=WELCOME=- new poster!!


dd
openSUSE®, the “German Engineered Automobile” of operating systems!
http://tinyurl.com/DD-Caveat

As noted you may not really need to build this at all, but if your like me you like to know why stuff doesn’t work when by all rights it should . . .

binutils-2.23.1 built cleanly for me on openSUSE 12.2 (x86_64), not errors on the TARGET macro being undefined.

Just out of curiosity, can you verify C_INCLUDE_PATH is unset? Everything I could find on this issue with binutils seems to point to this as a possibility?

Sourceware - binutils list - TARGET undefined in bucomm.c

Thanks a lot! I have tried


zypper se avr

before, but I get


Loading repository data...
Reading installed packages...


S | Name                           | Summary                        | Type      
--+--------------------------------+--------------------------------+-----------
i | avrdude                        | Upload tool for AVR microcon-> | package   
  | avrdude                        | Upload tool for AVR microcon-> | srcpackage
  | avrdude-debuginfo              | Debug information for packag-> | package   
  | avrdude-debugsource            | Debug sources for package av-> | package   
  | cross-avr-binutils             | GNU Binutils                   | package   
  | cross-avr-binutils             | GNU Binutils                   | srcpackage
  | cross-avr-binutils-debuginfo   | Debug information for packag-> | package   
  | cross-avr-binutils-debugsource | Debug sources for package cr-> | package   
  | libavresample0                 | FFmpeg libavresample           | package   
  | libavresample0-32bit           | FFmpeg libavresample           | package   
  | libavresample0-debuginfo       | Debug information for packag-> | package   
  | libavresample0-debuginfo-32bit | Debug information for packag-> | package

So at that time I thought SUSE did not have the packages avr-gcc and avr-libc. But from the website you gave me, I find the packages. Is it the matter that these two packages are unstable now, so I cannot find them in zypper?

But after I downloaded and installed the two, my avr-gcc did not work properly(but I dad not tested it deeply). So I try the suggestion by LewsTherinTelemon](https://forums.opensuse.org/members/lewstherintelemon.html)

Just out of curiosity, can you verify C_INCLUDE_PATH is unset? Everything I could find on this issue with binutils seems to point to this as a possibility?

And it works! I can compile binutils of version 2.23.1, and then avr-gcc and avr-libc by


tar -xjvf gcc-core-4.3.2.tar.bz2 
  cd gcc-core-4.3.2
  mkdir avr
  cd avr
  ../configure --target=avr --prefix=/usr/local/avrgcc --disable-nls --enable-language=c --disable-libssp
  make 
  make install

and


tar -xjvf avr-libc-1.8.0.tar.bz2 
  export CC=avr-gcc
  export AS=avr-as 
  export AR=avr-ar
  export RANLIB=avr-ranlib 
  export PATH=/usr/local/avrgcc/bin:${PATH}
  ./configure --prefix=/usr/local/avr --target=avr --host=avr
  make

After that, I try to compile a project which I wrote in my prevous ubuntu. But I get


avr-gcc -mmcu=atmega128 -Wall -Os -D F_CPU=8000000L   -c -o remoter.o remoter.c
avr-gcc -mmcu=atmega128 -Wall -Os -D F_CPU=8000000L   -c -o nrf24l01.o nrf24l01.c
avr-gcc -mmcu=atmega128 -Wall -Os -D F_CPU=8000000L   -c -o joystick.o joystick.c
avr-gcc -mmcu=atmega128 -Wall -Os -D F_CPU=8000000L   -c -o ad.o ad.c
avr-gcc -mmcu=atmega128 -Wall -Os -D F_CPU=8000000L   -c -o usart.o usart.c
avr-gcc -mmcu=atmega128 -Wall -Os --output remoter.elf remoter.o nrf24l01.o joystick.o ad.o usart.o
/usr/local/avr-gcc/bin/../lib64/gcc/avr/4.3.2/../../../../avr/bin/ld: cannot find crtm128.o: No such file or directory
/usr/local/avr-gcc/bin/../lib64/gcc/avr/4.3.2/../../../../avr/bin/ld: cannot find -lc
make: *** [remoter.elf] Error 1



Thanks you all a lot!! What’s the matter with me?

Now I have solved the problem by setting the same prefix for those three packages~~ Thanks everyone~~