LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2005, 02:58 PM   #1
dosnlinux
Member
 
Registered: Mar 2005
Distribution: slackware 11, arch 2007.08
Posts: 154

Rep: Reputation: 30
Question 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.
 
Old 05-06-2005, 03:35 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"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
 
Old 05-07-2005, 01:02 AM   #3
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
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.

Last edited by DaHammer; 05-07-2005 at 01:03 AM.
 
Old 02-10-2006, 09:41 PM   #4
Rufus T. Firefly
LQ Newbie
 
Registered: Feb 2006
Location: Hermosa CA
Distribution: Fedora
Posts: 8

Rep: Reputation: 0
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.
 
Old 02-28-2006, 05:45 PM   #5
mjrich
Senior Member
 
Registered: Dec 2001
Location: New Zealand
Distribution: Debian
Posts: 1,046

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

Cheers,

mjrich
 
Old 03-01-2006, 11:12 AM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
distcc cross architecture compiling Moebius Linux - Software 2 01-09-2008 06:20 AM
wx widget and cross compiling guideweb Programming 0 09-20-2005 11:06 PM
cross-compiling? jon_k Programming 3 12-09-2004 09:36 AM
cross compiling with g++ hornofsalvation Linux - Newbie 2 10-09-2004 10:29 PM
Building cross-compiling toolchain radhapriya Linux - Software 1 06-25-2004 12:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration