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.
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?
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?
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