LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Cross Compiling (https://www.linuxquestions.org/questions/programming-9/cross-compiling-320816/)

dosnlinux 05-06-2005 03:58 PM

Cross Compiling
 
I want to cross compile some programs (especially of the mozilla variety and home grown) for Windows on my Linux computer. I have gcc, but I have no Idea how to cross compile with it, or what I need to keep in mind when doing it.

Any help would be greatly apreciated.

jailbait 05-06-2005 04:35 PM

"I want to cross compile some programs (especially of the mozilla variety and home grown) for Windows on my Linux computer. I have gcc, but I have no Idea how to cross compile with it"

Here is a tutorial for cross compiling with Wintel as the target.

http://rooster.stanford.edu/~ben/linux/crosshowto.php

---------------------------
Steve Stites

DaHammer 05-07-2005 02:02 AM

Also check out Cygwin, DJGPP & Mingw. It's fairly easy to setup a toolchain for either of them under Linux that will output Windows executable code. I have all 3 setup under Slackware 10. Best I recall DJGPP was the most difficult to get working. There is a good guide for doing a Cygwin toolchain at colinux. The only bad thing about a Cygwin toolchain is that your app will require the cygwin1.dll be available for running it. All I use them for is CLI apps though.

Rufus T. Firefly 02-10-2006 10:41 PM

According to the link posted by Jailbait (up thread) the syntax for cross compiling to Windows is:

i586-mingw32msvc-gcc -o hello.exe hello.c

Using FC4 -- I've installed the following 4 rpm's ...

mingw-binutils-2.16.91-9hl.i386.rpm
mingw-gcc-core-3.4.4-12hl.i386.rpm
mingw-runtime-3.7-16hl.i386.rpm
mingw-w32api-3.5-16hl.i386.rpm

which went smoothly and I can compile my hello.c test case that
executes fine in a linux shell but nowhere can I find the executable command 'i586-mingw32msvc-gcc' for cross compiling to win32.

What did I miss? Are there other rpms I need to load to get the cross compile features? Is there an 'installing mingw for dummies' tutorial that I could follow?

Your help is appreciated -- thank you.

mjrich 02-28-2006 06:45 PM

You've looked in the usual places ? (Under Debian, the Mingw binaries end up in /usr/bin.)

Cheers,

mjrich

schneidz 03-01-2006 12:12 PM

this is from my xbox programming post:
http://www.linuxquestions.org/questi...d.php?t=420182

i needed mingw to cross-compile to .xbe format which is similar to winnt pe format (*.exe).

i used the following gcc switches (but i got compile errors)
Code:

gcc hello-world.c -std=gnu99 -ffreestanding -nostdlib -fno-builtin -fno-exceptions -march=i386 -I/usr/local/openxdk/i386-pc-xbox/include -I/usr/local/openxdk/include


All times are GMT -5. The time now is 12:03 AM.