public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compiling PE executables using linux hosted gcc
@ 2008-04-13  8:17 Jay
  2008-04-13 17:45 ` Brian Dessent
  2008-04-14  1:30 ` Kai Ruottu
  0 siblings, 2 replies; 4+ messages in thread
From: Jay @ 2008-04-13  8:17 UTC (permalink / raw)
  To: gcc-help

Hi! I'm developing a cross-platform framework and now it's time to port
it to Win32. I found that i can compile an executable for a certain
platform specifying -b command-line option however what i found further
just confused me so i'm here asking you this dumb question: how to
compile a pe executable using a linux hosted gcc? I run ubuntu 7.10 and
gcc 4.2.1. Many thanks in advance.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling PE executables using linux hosted gcc
  2008-04-13  8:17 Compiling PE executables using linux hosted gcc Jay
@ 2008-04-13 17:45 ` Brian Dessent
  2008-04-13 19:08   ` Jay
  2008-04-14  1:30 ` Kai Ruottu
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Dessent @ 2008-04-13 17:45 UTC (permalink / raw)
  To: Jay; +Cc: gcc-help

Jay wrote:

> Hi! I'm developing a cross-platform framework and now it's time to port
> it to Win32. I found that i can compile an executable for a certain
> platform specifying -b command-line option however what i found further
> just confused me so i'm here asking you this dumb question: how to
> compile a pe executable using a linux hosted gcc? I run ubuntu 7.10 and
> gcc 4.2.1. Many thanks in advance.

You need to build a cross toolchain (cross compiler, cross linker, cross
assembler.)  Note that gcc is just a compiler, it does not include the
linker or assembler which are part of binutils.

Just because Linux and Win32 both run on the same ia32 hardware does not
mean you can use the same tools, they are significantly different
targets/platforms (e.g. the PE assembler directives are not the same as
the ELF assembler, the linker is totally different, etc.)

The MinGW site has some scripts that will build such a set of cross
tools which is a good place to start since there can be a lot of minor
details to get right.  Also, those scripts will use gcc sources with
MinGW patches integrated, which fix a number of things that are broken
or unsupported in FSF gcc.  Therefore if you have trouble with the
scripts, post on the MinGW list.

Brian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling PE executables using linux hosted gcc
  2008-04-13 17:45 ` Brian Dessent
@ 2008-04-13 19:08   ` Jay
  0 siblings, 0 replies; 4+ messages in thread
From: Jay @ 2008-04-13 19:08 UTC (permalink / raw)
  To: gcc-help

Thank you Brian. Now i've got the clue. When i wrote 'gcc' i ment
everything that's installed when you select gcc package in software
manager and click Apply/Ok a couple of times. My mistake was that i
thought gcc can produce different types of executables depending on a
command line switch - some time ago i was playing with nasm that has
such a switch so i was misled by that experience.
On Sat, 2008-04-12 at 23:24 -0700, Brian Dessent wrote:
> Jay wrote:
> 
> > Hi! I'm developing a cross-platform framework and now it's time to port
> > it to Win32. I found that i can compile an executable for a certain
> > platform specifying -b command-line option however what i found further
> > just confused me so i'm here asking you this dumb question: how to
> > compile a pe executable using a linux hosted gcc? I run ubuntu 7.10 and
> > gcc 4.2.1. Many thanks in advance.
> 
> You need to build a cross toolchain (cross compiler, cross linker, cross
> assembler.)  Note that gcc is just a compiler, it does not include the
> linker or assembler which are part of binutils.
> 
> Just because Linux and Win32 both run on the same ia32 hardware does not
> mean you can use the same tools, they are significantly different
> targets/platforms (e.g. the PE assembler directives are not the same as
> the ELF assembler, the linker is totally different, etc.)
> 
> The MinGW site has some scripts that will build such a set of cross
> tools which is a good place to start since there can be a lot of minor
> details to get right.  Also, those scripts will use gcc sources with
> MinGW patches integrated, which fix a number of things that are broken
> or unsupported in FSF gcc.  Therefore if you have trouble with the
> scripts, post on the MinGW list.
> 
> Brian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Compiling PE executables using linux hosted gcc
  2008-04-13  8:17 Compiling PE executables using linux hosted gcc Jay
  2008-04-13 17:45 ` Brian Dessent
@ 2008-04-14  1:30 ` Kai Ruottu
  1 sibling, 0 replies; 4+ messages in thread
From: Kai Ruottu @ 2008-04-14  1:30 UTC (permalink / raw)
  To: Jay; +Cc: gcc-help

Jay wrote:
> Hi! I'm developing a cross-platform framework and now it's time to port
> it to Win32. I found that i can compile an executable for a certain
> platform specifying -b command-line option however what i found further
> just confused me so i'm here asking you this dumb question: how to
> compile a pe executable using a linux hosted gcc? I run ubuntu 7.10 and
> gcc 4.2.1. Many thanks in advance.

Ubuntu should be Debian, Debian provides a prebuilt MinGW-targeted 
crosstoolchain, so your problem should be how to install those Debian
packages for MinGW target... For instance :

ftp://ftp.funet.fi/pub/linux/mirrors/debian/pool/main/m/mingw32
ftp://ftp.funet.fi/pub/linux/mirrors/debian/pool/main/m/mingw32-binutils
ftp://ftp.funet.fi/pub/linux/mirrors/debian/pool/main/m/mingw32-runtime

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-13 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-13  8:17 Compiling PE executables using linux hosted gcc Jay
2008-04-13 17:45 ` Brian Dessent
2008-04-13 19:08   ` Jay
2008-04-14  1:30 ` Kai Ruottu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).