Page 1 of 1

GCC Cross Compiling help

Posted: Thu Mar 09, 2006 8:25 pm
by Warrior
Hello all, I seem to be having problems with my GCC cross compiler.

I compiled binutils and gcc just fine and I can know use $target-gcc to compile files. The issue comes with linking, is there a need to compile "ld" again for the host OS or something?

When I tried to link object files I get the following errors:

"PE operations on a non PE file"

When I try to just create an EXE via -o parameter in C I get unreferenced alloca and main.

I'm not an avid Linux user so most of this is new to me.

Any help is appreciated, thanks.

Re:GCC Cross Compiling help

Posted: Thu Mar 09, 2006 11:10 pm
by Solar
Nelson wrote: The issue comes with linking, is there a need to compile "ld" again for the host OS or something?
'ld' is part of binutils. You will find a $target-ld in the same place as your $target-gcc. ;)

Re:GCC Cross Compiling help

Posted: Fri Mar 10, 2006 12:16 am
by Warrior
Alright, I've done something wrong. I also misread the FAQ in which versions were compatible (It seemed to contridict itself sometimes) but I'm redownloading with binutils 2.16 and gcc 3.4.3

Thanks

Re:GCC Cross Compiling help

Posted: Sat Mar 11, 2006 9:26 am
by Warrior
Sorry for the double post, but I got it working. The problem was (as with the previous) was enviroment variables werent being saved. I simple set it to create temp ones in a startup script and was happily on my way.

I just appended /usr/cross/bin to PATH and made TARGET be i586-elf

So then I can do

$TARGET-gcc and $TARGET-ld and other utils

Thanks!