Real Dumb Quickstart
This is a fast step-by-step guide to getting MinGW up and running on your windows box, to save you the pain and frustration I suffered.
(If you're not as impatient as I, you can find an older and more detailed guide at GettingStarted.)
Dumber Than Dumb, Faster Than Fast
Except you can just fetch just a MinGW exe and an MSYS exe, run those, edit your PATH, and go, ...
... if you're only trying to add gcc and g++ and a few Unix tools like grep and vi to your Windows Cmd.exe shell.
For example, on 2005-12-20, the mingw.org Download page had a File List, and that list was not empty if you waited enough seconds to see it. Then in that list you could find "Current" "MSYS-1.0.10.exe" and "Proposed" "MinGW-5.0.0.exe". Running that MinGW on an Internet-connected Windows (yuck) and choosing the 'Download only' rather than 'Download as needed and install' constructed a "Current" monolithic installer in a local folder for you. Copy that folder to a Windows machine, run both installers, remember to again explicitly ask MinGW for g++, and hey presto you have gcc g++ vi etc. etc. on that Windows machine too.
But if you're ready to get more involved, then:
I've been writing a lot of Python code for Linux and Windows, using gcc to build my extensions on the Linux side, and msvc6 to build them on the windows side.
This worked great, till Python 2.4. This Python is built with MSVS .Net 2003, a whole different compiler, so my old trusty msvc6 just doesn't cut it any more. I tried the free command-line MS compiler toolchains, both the 'MS Visual Studio 2003 Toolkit' and the 'Visual Studio SDK'. Unfortunately, neither of these worked because Python2.4 needs stuff, such as headers, not available in those free compilers.
Getting MSVS .Net 2003 is not an option for me, financially speaking, so I looked into MinGW.
As someone who likes to double-click on an exe or msi installer file, or type 'apt-get install something' on the linux side, I found the MinGW installation instructions a bit lengthy and scattered. Owing to my impatience, I tried 5 times to get the MinGW compiler and supporting tools set before I finally got it right.
About this document
I've written this document in a step by step fast walkthrough style, because this is what I best relate to personally, so at least some others might find it useful too.
Go to the MinGW download page and download the following files from the 'Current' list (replacing the 'x.x.x' with the current version numbers)
Don't crack the tarballs just yet. We'll do that in the next sections.
Installing MSYS and MinGW
First we have to install MSYS. Once that's done, we'll add the MinGW files.
MSYS is a clean, lightweight and user-friendly fork of cygwin that omits that infamous boat-anchor called 'cygwin.dll', and spares you of having to download and install Cygwin's considerable bloat.
MinGW runs within the MSYS environment, and gives you a pleasant unix-ish shell environment.
Let's get MSYS installed, set up and running first. Follow these steps
run MSYS-x.x.x.exe, and accept the defaults
run msysDTK-x.x.x.exe, ditto
run mingw32-make-x.x.x.exe, ditto
run the MSYS shell (Start, Programs, MinGW, MSYS, msys)
Congratulations, if you're seeing a shell window, then you've got the underlying MSYS working.
Now, within the MSYS shell
type cd /mingw to set your cwd to the mingw directory
copy all the above .tar.gz files into this directory
type the command: for i in `ls *.tar.gz`; do tar xfz $i; done
type ls /mingw to confirm that there is now a bunch of new directories in mingw, such as bin, include, lib, doc, info, lib, libexec, man
type cp -a /mingw/mingw32/* /mingw
It's crucial to crack the tarballs into /mingw (C:/msys/n.n/mingw), because if you crack any of them into / (C:/msys/n.n), you'll cause some subtle conflicts between MSYS and the MinGW tools which will cause your compilations to fail.
Test your installation
Type 'cd' into your MSYS shell, to go to your home directory. Using vi, or your favourite editor, create a file called 'temp.c' in that directory, containing just:
When that file is saved, type the command gcc temp.c.
If the command completes successfully, and produces a file called a.exe, then congratulations, your MinGW compiler environment is now working and ready to use.
Note - if, like me, you're into building Python extensions, then don't forget to check out the instructions in Python extensions.
Last edited on August 26, 2006 1:20 pm.