GCC Cross Compiling help

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
Warrior

GCC Cross Compiling help

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:GCC Cross Compiling help

Post 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. ;)
Every good solution is obvious once you've found it.
Warrior

Re:GCC Cross Compiling help

Post 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
Warrior

Re:GCC Cross Compiling help

Post 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!
Post Reply