Page 1 of 1

making a cross-compiler from gcc

Posted: Sun Apr 04, 2004 8:03 am
by Candy
I've been messing around with this for some time now, and somehow it just won't work. I've set the target right and everything, tried some stuff, but it keeps on compiling both ada code, java code & it tries to build libraries for the new target, which doesn't have any library so it complains about missing pthreads and stuff like that. I've followed the cross-compiler-making route of the osfaq literally, except for the first target. Targets tried are x86_64-pc-linux and i686-pc-linux. Does anybody know how to fix this?

[edit] the errors are added [/edit]

The exact errors:
i686 target:

Code: Select all

/usr/src/build-gcc-i686/gcc/xgcc -B/usr/src/build-gcc-i686/gcc/ -B/usr/cross/i686-pc-linux/bin/ -B/usr/cross/i686-pc-linux/lib/ -isystem /usr/cross/i686-pc-linux/include -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc-3.3.2/gcc
-I../../gcc-3.3.2/gcc/. -I../../gcc-3.3.2/gcc/config -I../../gcc-3.3.2/gcc/../include  -DL_muldi3 -c ../../gcc-3.3.2/gcc/libgcc2.c -o libgcc/./_muldi3.o
In file included from tconfig.h:23,
                 from ../../gcc-3.3.2/gcc/libgcc2.c:36:
../../gcc-3.3.2/gcc/config/i386/linux.h:232:20: signal.h: No such file or directory
../../gcc-3.3.2/gcc/config/i386/linux.h:233:26: sys/ucontext.h: No such file or
directory
make[2]: *** [libgcc/./_muldi3.o] Error 1
make[2]: Leaving directory `/usr/src/build-gcc-i686/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory `/usr/src/build-gcc-i686/gcc'
make: *** [all-gcc] Error 2
root@michael:/usr/src/build-gcc-i686#
x86_64 version:

Code: Select all

/usr/src/build-gcc/gcc/xgcc -B/usr/src/build-gcc/gcc/ -B/usr/cross/x86_64-pc-linux/bin/ -B/usr/cross/x86_64-pc-linux/lib/ -isystem /usr/cross/x86_64-pc-linux/include -O2  -DIN_GCC -DCROSS_COMPILE -DNATIVE_CROSS   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc-3.3.2/gcc -I../../gcc-3.3.2/gcc/. -I../../gcc-3.3.2/gcc/config -I../../gcc-3.3.2/gcc/../include -fexceptions -c ../../gcc-3.3.2/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.o
In file included from ../../gcc-3.3.2/gcc/unwind-dw2.c:26:
../../gcc-3.3.2/gcc/unwind-pe.h: In function `size_of_encoded_value':
../../gcc-3.3.2/gcc/unwind-pe.h:76: warning: implicit declaration of function `abort'
In file included from gthr-default.h:1,
                 from ../../gcc-3.3.2/gcc/gthr.h:98,
                 from ../../gcc-3.3.2/gcc/unwind-dw2.c:28:
../../gcc-3.3.2/gcc/gthr-posix.h:37:21: pthread.h: No such file or directory
../../gcc-3.3.2/gcc/gthr-posix.h:38:20: unistd.h: No such file or directory
In file included from gthr-default.h:1,
                 from ../../gcc-3.3.2/gcc/gthr.h:98,
                 from ../../gcc-3.3.2/gcc/unwind-dw2.c:28:
../../gcc-3.3.2/gcc/gthr-posix.h: At top level:
<snap about 200 lines of errors>
../../gcc-3.3.2/gcc/unwind-dw2.c:1223: error: `once_regsizes' undeclared (first
use in this function)
../../gcc-3.3.2/gcc/unwind-dw2.c:1237: warning: implicit declaration of function `memcpy'
make[2]: *** [libgcc/./unwind-dw2.o] Error 1
make[2]: Leaving directory `/usr/src/build-gcc/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/usr/src/build-gcc/gcc'
make: *** [all-gcc] Error 2
root@michael:/usr/src/build-gcc#
Both are being compiled on a i686-pc-linux for a i586-pc-linux (laptop) with these targets. I believe this is called a canadian cross.

Re:making a cross-compiler from gcc

Posted: Mon Apr 05, 2004 1:36 am
by Pype.Clicker
shouldn't your -i... stuff be -I... (capitalized i) instead ?

Re:making a cross-compiler from gcc

Posted: Mon Apr 05, 2004 2:02 am
by Candy
Pype.Clicker wrote: shouldn't your -i... stuff be -I... (capitalized i) instead ?
These were autogenerated commands by gcc to compile libg++ and some other libs (I've seen libiberty come by). I believe the -i stands for new system include dirs as opposed to additional include dirs.

the point is, I'm don't /WANT/ those libs. Yet, the compiler tries to compile them, tries to find some headers I don't have and even shouldn't have (explicitly disabled threading support, and it still tries to add pthread.h to the code) so the compilation fails. How do I tell the compiler not to even try those things?

I suspect the temporary compiler that's used for these things is the same as the one I'm trying to generate, but I'd like to follow the normal course once...

Re:making a cross-compiler from gcc

Posted: Mon Apr 05, 2004 2:36 am
by Solar
Candy wrote: I've followed the cross-compiler-making route of the osfaq literally, except for the first target. Targets tried are x86_64-pc-linux and i686-pc-linux. Does anybody know how to fix this?
Hm... the FAQ page is basically a 1:1 copy of what I do to get my cross-compiler up and running. What would be helpful is if you could give a copy of the commands you used; I could then try to reproduce your errors.

Re:making a cross-compiler from gcc

Posted: Mon Apr 05, 2004 3:09 am
by Candy
Solar wrote:
Candy wrote: I've followed the cross-compiler-making route of the osfaq literally, except for the first target. Targets tried are x86_64-pc-linux and i686-pc-linux. Does anybody know how to fix this?
Hm... the FAQ page is basically a 1:1 copy of what I do to get my cross-compiler up and running. What would be helpful is if you could give a copy of the commands you used; I could then try to reproduce your errors.
I've used the EXACT same commands you have, modifying the target= and in one case adding --host=i586-pc-linux.

I now kind of suspect the i586-elf to be different from i586-pc-linux or i686-pc-linux or x86_64-pc-linux (note, x86_64-elf does not work because it's not defined).

Still, I really really want the x86-64 compiler to work. Do you have an idea?

[edit] yes, it's the -pc-linux portion that wrecks gcc. The i686 version is now complete, still working on the x86_64 one. When it's compiled & working I'll put it online. Compiling for i586 machines btw.[/edit]