Comment # 19 on bug 936463 from
I successfully built my first avr binary with gcc5 only!


But there are still remaining things to resolve, and make them packaged.

0) Made as and ld symlinks as mentioned before.

1) libgcc.a is needed. I did:
-add_cross cross-avr-gcc$base_ver avr avr-suse-linux %define gcc_icecream 1
+add_cross cross-avr-gcc$base_ver avr avr

Then I manually copied existing avr-libc headers and removed package dependency
on cross glibc.

I was able to compile libgcc.a by "make target" for gcc-5.1.1-r223279 (Factory
-r4) and manually copied it to /usr/lib64/gcc/avr-suse-linux/5/avr5. (avr5 is a
sub-platform, where most 8-bit Arduinos belong).

I am afraid, that it was a random success, and it will need some work to
compile in future (and correctly), as some files reference headers that are not
present in avr-libc. In gcc-5.1.1-r223279, use of system headers does not cause
(compilation time) problems. In the latest snapshot it does.


2) Then create avr-g++ and avr-gcc wrappers:
exec /usr/bin/avr-suse-linux-{gcc or g++}-5 -B/opt/cross/avr/avr
-L/opt/cross/avr/avr/lib "$@"


3) Compile avr-libc. It currently fails:
avr-gcc -DHAVE_CONFIG_H -I. -I../../..  -I../../../common -I../../../include
-I../../../include  -Wall -W -Wstrict-prototypes -mmcu=avr2
-D__COMPILING_AVR_LIBC__ -mcall-prologues -Os  -MT strtod.o -MD -MP -MF
.deps/strtod.Tpo -c -o strtod.o ../../../libc/stdlib/strtod.c
../../../libc/stdlib/strtod.c:40:20: fatal error: limits.h: No such file or
directory
Missing limits.h is in their TODO list.
I did
cp -a
/var/tmp/build-root/openSUSE_Factory-x86_64/home/abuild/rpmbuild/BUILD/gcc-5.1.1-r223279/obj-x86_64-suse-linux/gcc/include-fixed/limits.h
include/

Ugly, but helped. I got avr-libc compiled.


4) avr-libc is not in sync with gcc5 and requires different names of the main
libraries.
libatmega168.a (gcc5) = 
avr-libc/avr5/atmega168/libcrt.a => to
/usr/lib64/gcc/avr-suse-linux/5/avr5/libatmega168.a
avr-libc/avr5/atmega168/crtm168.o =>
/usr/lib64/gcc/avr-suse-linux/5/avr5/crtatmega168.o
(Well, it should probably belong elsewhere in the compiler library path.)


5) arduino, pick any sketch, compile. Works!


=>

- I will probably need avr-libc-newlib as well. However I still believe that is
not needed in real on AVR, it would be easier to make two level libc staging
exactly as other platforms do with glibc.

- Only minor modifications of existing spec files will be needed to support
AVR.

- Some modifications (or hacks) will be probably needed to gcc itself, to not
include headers not present in the target platform or not compile stuff not
needed on target platform at all.

- This work could be recycled for other non-Linux/non-glibc platforms.


You are receiving this mail because: