Building cross gcc and binutils is easy, but for the libc/libgcc parts. I've wrestled with this a lot.
I'm trying to build an ia64-linux cross toolset from a Mac. Including cross building glibc. I've gone through many options and errors, including sysroot and not, following the LFS stuff and the CLFS stuff. (Linux-from-Scratch, Cross-Linux-from-Scratch) (CLFS good in that it uses sysroot and is cross, but it uses older versions and for now I gave up, and non-cross-LFS is basically cross anyway.) Some of what I hit: In file included from /src/gcc-4.6.2/libgcc/../gcc/unwind-sjlj.c:30:0: /obj/gcc/./gcc/include/unwind.h:214:20: fatal error: stdlib.h: No such file or directory /src/gcc-4.6.2/libgcc/../gcc/config/ia64/fde-glibc.c:33:20: fatal error: stdlib.h: No such file or directory /src/gcc-4.6.2/libgcc/../gcc/config/ia64/fde-glibc.c:36:18: fatal error: link.h: No such file or directory and suggest, more use of inhibit_libc: jbook2:gcc-4.6.2 jay$ diff -u gcc/config/ia64/fde-glibc.c.orig gcc/config/ia64/fde-glibc.c --- gcc/config/ia64/fde-glibc.c.orig 2011-11-12 13:30:55.000000000 -0800 +++ gcc/config/ia64/fde-glibc.c 2011-11-12 13:32:47.000000000 -0800 @@ -25,6 +25,8 @@ /* Locate the FDE entry for a given address, using glibc ld.so routines to avoid register/deregister calls at DSO load/unload. */ +#ifndef inhibit_libc + #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif @@ -160,3 +162,5 @@ return data.ret; } + +#endif jbook2:gcc-4.6.2 jay$ diff -u gcc/unwind-generic.h.orig gcc/unwind-generic.h --- gcc/unwind-generic.h.orig 2011-11-12 13:02:32.000000000 -0800 +++ gcc/unwind-generic.h 2011-11-12 16:11:46.000000000 -0800 @@ -211,7 +211,9 @@ compatible with the standard ABI for IA-64, we inline these. */ #ifdef __ia64__ +#ifndef inhibit_libc #include <stdlib.h> +#endif static inline _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *_C) @@ -223,7 +225,9 @@ static inline _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__))) { +#ifndef inhibit_libc abort (); +#endif return 0; } I understand the result is "broken" and that a second build will be needed. But that seems to be common practise in building a cross toolset when "libc" doesn't already exist. And even then, I'm not done. Maybe this still won't work. I know about buildroot for example but they don't have IA64 support. I'm going to see if there is an option for building without any exception handling support. It looks like not. Though this diff sort of does that. Another thing I'll try is skipping libgcc for the first pass. But I did get an error about missing libgcc when building glibc. The 64bit math stuff at least ought to go in, but I realize it's probably not needed for 64bit targets. Thank you, - Jay