GCC Cross Compiler

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Cjmovie

GCC Cross Compiler

Post by Cjmovie »

Following the OS-Faq guide to building a cross compiler, I've come upon many problems.

Up until this one, I have seen easy fixes. This one I just plain have no idea. As a note:

I have over-ridden the target host machine to be i686-unknown-cygwin, as it detects x86_64-unknown-cygwin, and GCC reports (after doing all the checks...) it doesn't compile for x86_64. I'm compiling GCC 3.4.0, and this is the output I get from it:

Code: Select all

mkdir -p -- libgcc
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
/usr/src/build-gcc/gcc/xgcc -B/usr/src/build-gcc/gcc/ -B//bin/ -B//lib/ -isystem
 //include -isystem //sys-include -O2 -I../../gcc-3.4.0/gcc/../winsup/w32api/inc
lude -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototyp
es -Wold-style-definition  -isystem ./include   -g  -DIN_LIBGCC2 -D__GCC_FLOAT_N
OT_NEEDED  -I. -I. -I../../gcc-3.4.0/gcc -I../../gcc-3.4.0/gcc/. -I../../gcc-3.4
.0/gcc/../include  -DL_chkstk -xassembler-with-cpp -c ../../gcc-3.4.0/gcc/config
/i386/cygwin.asm -o libgcc/./_chkstk.o
cc1: //include: No such host or network path
cc1: //sys-include: No such host or network path
make[2]: *** [libgcc/./_chkstk.o] Error 1
make[2]: Leaving directory `/usr/src/build-gcc/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory `/usr/src/build-gcc/gcc'
make: *** [all-gcc] Error 2
To configure it, I used:

Code: Select all

$ ../gcc-3.4.0/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c --without-headers --host=i686-unknown-cygwin
The only real difference being "--host" and the lack of c++.
Binutils is already compiled fine, however, for host machine x86_64.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:GCC Cross Compiler

Post by Solar »

I assume that Cygwin installs the same binaries (i686) even when installed on a x86_64 machine. (You could check that with gcc -v.)

That would make what you are trying to do a "Canadian Cross": Using a i686-pc-cygwin compiler to build a compiler that runs on x86_64-unknown-cygwin and generates binaries for... whatever.

My first solution would be to reduce the problem to a "normal" cross-compiler: Do you really need the binutils and GCC to be hosted on x86_64-unknown-cygwin? Wouldn't a "standard" i686 build, without overriding --host, suffice?

I know all about the desire to build the "best", but "best" includes "working"... and I have no chance to reproduce your problem since I don't have a x86_64 machine at my disposal.

Candy might have, though - he tinkered with 64/32bit cross-setups some time ago.
Every good solution is obvious once you've found it.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:GCC Cross Compiler

Post by Candy »

Solar wrote: Candy might have, though - he tinkered with 64/32bit cross-setups some time ago.
If only I did. Santa wasn't nice to me (or I wasn't nice enough - can't figure out which) so I didn't get an AMD64 computer. I've only been playing in the Bochs sandbox. Got a bootloader working and I've got the crosscompiler for normal -> OSdev AMD64 working so I can at least see if my code compiles (I usually don't make very complex errors so the compiler can rip them out. When I do make a complex error it's usually so complex that it takes days to figure out in any case, so it doesn't matter).
Cjmovie

Re:GCC Cross Compiler

Post by Cjmovie »

Canadian Cross? Sure, with the binutils. But I didn't override the host with that one. On GCC, if I didn't, it stopped halfway in compile saying it didn't support compiling for x86_64. The host override tells it to install i686 binaries:
--host=i686-unknown-cygwin
*edit*
OMG...can't beleive I spelled 'sure' as 'shure'.....
Cjmovie

Re:GCC Cross Compiler

Post by Cjmovie »

I played and around with it and somehow it worked...I used the same options I think. Whatever happened, I don't know.

Oh, and I just got my dual-channel 1GB RAM in. It's schweet. My PC has 30 processes running and 8 icons in the systray...And it started up (literally from pressing the power button) in under 15 seconds. Gotta love it.

*edit*
By start up, I mean, logged in, at the desktop, everything loaded.
Post Reply