views:

411

answers:

1

At the MinGW download page you can download the "Cross-Hosted MinGW Build Tool" which is a shell script to build the "MinGW cross-compiler" so that you will be able to compile your programs on "Linux" to the "Windows" target.

I have downloaded that script, run it and answered the interactive questions the script has asked me. I had to dowload some files from which one has name "gcc-core". And the "latest" version of the "gcc-core source code" I have found on that page, was "gcc-core-3.4.5-20060117-2-src.tar.gz" - so that "3.4.5" version.

But on "Ubuntu Linux" I can download the precompiled "mingw32" package which is of the version "4.2.1". How is it possible that the "Ubuntu package" version of MinGW is newer than the one from the MinGW "homepage"?

So which is the latest version of the "MinGW cross compile tool"?

+2  A: 

When cross compiling you have to build the toolchain targeting the platform you want it to generate executable code for, which means that you may do it without a script. You'll just need the sources of GCC (in this case).

Grab the sources, for example the ones for GCC 4.4 and unpack them in a directory, then run configure, make and make install.

The following would be an example of a configure call targeting an i686 for Windows:

./configure --target=i686-mingw32 --host=$CHOST --build=$CHOST \
--prefix=/usr --enable-languages=fortran,c,c++ --enable-sjlj-exceptions \
--enable-hash-synchronization --disable-nls --disable-libssp --disable-shared
Xandy