[MLton-user] MinGW Cross-compile
Pete Chown
1@234.cx
Wed, 05 Nov 2003 00:04:31 +0000
Anoq of the Sun wrote:
> I have been fighting a few times trying to get the MinGW
> version of GCC to compile by modifying the
> build-cross-gcc script.
Do you mean you can't get MLton to compile with a cross-compiling gcc,
or you can't get gcc itself to build? If you just want to build a
cross-compiling gcc, don't worry about that script, just do it by hand.
Extract the gcc source, then create a build directory at the same
level. So you might have ~pc/gcc-3.3.2 and ~pc/gcc-build. Now go into
the build directory and run configure as follows:
../gcc-3.3.2/configure --prefix=/usr/local/mingw
--with-local-prefix=/usr/local/mingw --enable-languages=c
--with-headers=[whatever]/win32/include --with-libs=[whatever]/win32/lib
--target=i386-pc-mingw32msvc
You can use whatever you want for --prefix, it just controls where the
installed files go. You probably don't want to install in your regular
binary directory, though it won't overwrite your normal gcc. To avoid
this it will use program names like i386-pc-mingw32msvc-gcc.
Specify --with-local-prefix to stop gcc searching your normal include
files. It will get very confused if it picks up some Unix and some
Windows headers. (This can be a big problem if you're building for
MinGW on Cygwin, one reason why I think it's better to do a real cross
compile from Linux.)
--with-headers and --with-libs should point to the place where you have
unpacked your Windows SDKs. The headers and libraries will be copied to
the install directory. This should include windows.h, allowing the
compiler to find it. ;-)
Now type make and make install. Oh, and you have to do binutils too,
and install it before attempting to build gcc.
--
Pete