toc next
MinGW32 Cross Compile
What you need
If you already have MinGW32 cross compile tools installed, you can skip
this step. If not, there are a
few ways of setting this up.
- Your distro has a xmingw package you might be able to use (I've
never tried this).
- You could get the following binary: http://www.libsdl.org/extras/win32/cross/mingw32-linux-x86-glibc-2.2.tar.gz
Which is a prebuilt of option 3. Though this binary targets i386
(rather
than i586) and might be using an
older version gcc (I've not tried this)
- Follow my instructions below to build a
recent version of MinGW32 (recommended)
To build the cross compile system you need:
- bash shell enviroment (with
mkdir, echo,
test, su, cp and what
nots)
make (with related tools like install,
sed, awk,...)
- gcc compiler for c/c++ (and related tools)
- wget (or curl, proz, your favorite command line downloader..)
You should be able to get these tools through your distribution's
pakage manager. And you need to get my modified version of build-cross.sh
(this was original found at http://www.libsdl.org/extras/win32/cross/build-cross.sh.
My version is updated and modified to target i586 rather than i386). If
you are interested in doing this manually, please take a look at the
script, it should not be too hard to follow.
Step by Step
Instructions
- put the downloaded
build-cross.sh in a temporary
directory with
lots of free space.
- edit
build-cross.sh with your favorite text file
editor.
- un-comment or set
PREFIX to the directory you
want your
MinGW32 cross tools to be installed in.
- un-comment
DO_SU if you are installing into a
directory that
needs root access to write to it (you will be prompted for your root
password 4 times)
- pick your favorite downloader by uncommenting one of the
lines starting with
DOWNLOADER or set it to your command
line download
program
- set
CFLAGS to optimisations that make sense
for your platform, I'd recommend "-O3 -march=your_cpu",
where your_cpu is the type of processor you are using.
- pick your favorite MinGW32 mirror by uncommenting one of the
lines starting with
MINGW_URL
- save and exit
- do the following at a shell in the directory you placed
build-cross.sh:
chmod +x build-cross.sh./build-cross.sh
- The script will now download, build and install the MinGW32
cross compile tools. If you set the DO_SU variable it will prompt you
for your password 4 times to gain root access to install the
tools.
Convenient
Scripts
There are two scripts which I find really convenient:
cross-configure.sh and cross-make.sh, you
can get them here:
You will need to modify these scripts to point to where your cross
tools are
installed by changing the PREFIX and TARGET
variables in the scripts to match what is in your build-cross.sh
script.
And put them in a directory somewhere in your path so that you can use
them like any other command (you could copy them to your /usr/bin
directory for example).
Other MinGW32 Cross
Compile Instructions
There are other MinGW32 cross compile instructions found at:
I have never tried any of these instructions.
toc next