TODO: Convert to the MediaWiki formatting as discussed at Converting Old MinGWiki Pages
TODO: Revise untar instructions.
Using the (possibly "Proposed"/"Candidate") Installer
If you are new to MinGW, the recommended way to begin is to download an installer executable from https://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780 and run it (e.g. "MinGW-5.1.4.exe" -- currently there is only a 'Proposed' Version). This package will install mingw-runtime, w32api, GCC, binutils and mingw32-make but it may not be the latest versions of the individual packages. Once you have all these packages (although mingw32-make is not necessary if you have MSYS or Cygwin), you may download updated individual packages like GCC and extract them into the MinGW directory.
- Warning:* For versions prior to MSYS-1.0.11; do not install MinGW into the same path as MSYS (but it can be a subdirectory as long as non-MSYS executables are not in the MSYS bin directory)
- Warning2:* When you install msys and mingw, and have /mingw mapped to your mingw directory (as is the default), if you install ports or install any programs, they must install to /mingw to be available for gcc to use (i.e. ./configure --prefix=/mingw).
Manual installation (non one-click method)
Instead of using an installer you can as well get all required packets and unpack them manually into a subdirectory. In fact that's what this writer is doing himself.
Download the packages
At least the following (or newer) packages from the
- MinGW download page http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82721
are needed (the automated mingw installer I think includes all of these and sets up the right directory for you--what it's doing is downloading compilers and default header files, and putting them in one place on your system, so the future builds will use those compilers and directories for building):
- GNU Binutils: http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11290
- GCC Version 3: http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82723
- MINGW Runtime: http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11598
- Windows 32 API: http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11550
Note that you will need gcc-core for other gcc language frontends to work properly.
These files are gzipped tarballs, Linux users will probably be familiar with .tar.gz files, but they are not that common under Windows. Essentially they are compressed folders like zip files. In order to access the contents you will need to decompress them, this requires that you have gzip and tar installed on your machine. Linux comes with these as standard in every distribution, but under Windows you will need to install them manually. Windows versions can be found at:
- Gzip for Windows: http://gnuwin32.sourceforge.net/packages/gzip.htm
and
- LibArchive for Windows, TAR: http://gnuwin32.sourceforge.net/packages/tar.htm.
Download the setup files and install the applications. Before you use them you need to tell Windows where to find them; specifically this means adding the install directory to your PATH. To do this carry out the following procedure (Warning - adding entries to the path is totally benign, however if you delete you mess up your path string then you could seriously compromise the functioning of your computer, please be careful):
- Right-click on "My Computer" and select "Properties".
- Click Advanced -> Environment Variables.
- In the box entitled "System Variables" scroll down to the line that says "Path" and double-click the entry.
- You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the Path variable. It is *very* important that you do not delete the existing values in the path string, this will cause all sorts of problems for you!
- Scroll to the end of the string and at the end add ";<installation-directory>\bin". Here <installation-directory> is the full address of the installation directory; if you accepted the defaults when installing tar and gzip then it will (probably) be "C:\Program Files\GnuWin32". Don't forget the semicolon, this separates the entries in the path.
- press OK -> OK -> OK and you are done.
Create install directory
Create a directory to install all the stuff into. This writer usually creates c:\MinGW and copies all of the above files in there. Now issue the following commands, remember to change the file names to match your downloads:
cd /d c:\MinGW gzip -df binutils-2.16.91-20060119-1.tar.gz tar -xf binutils-2.16.91-20060119-1.tar cd info ren dir dir.binutils cd .. gzip -df gcc-core-3.4.5-20060117-1.tar.gz tar -xf gcc-core-3.4.5-20060117-1.tar cd info copy dir dir.gcc copy dir+dir.binutils cd .. gzip -df gcc-g++-3.4.5-20060117-1.tar.gz tar -xf gcc-g++-3.4.5-20060117-1.tar gzip -df mingw-runtime-3.9.tar.gz tar -xf mingw-runtime-3.9.tar cd info ren dir dir.gcc cd .. gzip -df w32api-3.6.tar.gz tar -xf w32api-3.6.tar
(The commands copying and concatenating the info-dir files are really a rather crude way of creating a combined dir file and could use some enhancement.)
Additional programming languages
To add additional languages apply some or all of the following commands:
cd /d c:\MinGW tar xvzf gcc-ada-3.4.5-20060117-1.tar.gz tar xvzf gcc-g77-3.4.5-20060117-1.tar.gz tar xvzf gcc-java-3.4.5-20060117-1.tar.gz tar xvzf gcc-objc-3.4.5-20060117-1.tar.gz
MSYS installation
You may also want to install MSYS.
See also: Getting Started
Re: HOWTO Install the MinGW (GCC) Compiler Suite
While the gzip and tar commands are useful, it would be useful to state the directory name explicitly for those like me that choose to manually create the info-dir directories another way. It was not clear whether the directory needed to be named 'dir' or 'info-dir' or 'dir.cc', etc, without crinkling the brow. Thanks for all this, btw...
Re: HOWTO Install the MinGW (GCC) Compiler Suite
In the context of info, `dir' is a file, not a directory (in the file system sense); it is always called `dir', and is found in a directory in the `INFOPATH'. Please see the comment below, which I added in August 2008, concerning the proper way to manage info's `dir' files.
Re: HOWTO Install the MinGW (GCC) Compiler Suite
I propose merging these instructions into the existing instructions on the Getting Started page. I don't see the sense in having automated installation described on the Getting Started page and manual installation described in a HOWTO.
Re: HOWTO Install the MinGW (GCC) Compiler Suite
I can see a practical reason for keeping them segregated.
The `Getting Started' really should be just a `Quick Start' guide, for new users. Such users really don't want to be overwhelmed by too much detail -- they just want to get up and running with a minimum of fuss.
OTOH, more experienced users may appreciate more detailed information. Such users may wish to maintain multiple installations, at different version levels for example, or to incrementally upgrade an existing installation, as newer components are released. (They may wish to do this directly, *without* having to go through the pain of running a nasty wizard style installer, which is really best suited to first time installation only -- ok, that's just my opinion of them, but I'm sure I'm not alone). The detailed information needed to facilitate this doesn't really belong in a `Getting Started' guide; it deserves a more extensive `HOWTO' document.
I'd actually suggest *simplifying* the `Getting Started' page, (to make it a real `Quick Start' guide), and keep this `HOWTO' as a detailed reference. Include a link to here, on the `Getting Started' page, for users wanting more detail, and if necessary merge any content removed from `Getting Started' in here.
Re: HOWTO Install the MinGW (GCC) Compiler Suite
Re the concatenation of info/dir files:
More recent versions of the distributed packages should not even provide the precompiled dir files. These are only useful for users who have an info viewer installed, which basically means those who use MSYS[1].
For those who do use MSYS, you will have both the info viewer, and also the supporting makeinfo and install-info tools; the correct way to build the dir file is to run each of the supplied *.info files through install-info:
cd info; for file in *.info; do install-info $file dir; done
[1] Yes, I know GnuWin32 also provides an info package; last time I looked, their viewer didn't work. Cygwin also has it, and that works, but uses the dir files installed in the Cygwin tree. It is possible an alternative native implementation is available elsewhere; if so, it should also provide an install-info tool.