This is an old revision of the document!
Setting up the build environment on Windows
Assuming Windows XP 32. We will use MinGW to build the libraries and application and MSYS as a working environment.
The distinction between MinGW and MSYS is very important: MinGW is a set of compilers and libraries you use to build Windows applications, while MSYS is a GNU environment similar to (and, in fact, based on) Cygwin. You can not use MSYS libraries in your Windows application.
Subversion
Doesn't really matter which one. Certified binaries of The Real McCoy are available at http://www.collab.net/downloads/subversion/ (command-line only) if you have an account (or are willing to register). There are other (non-certified) sources such as SlikSVN (http://www.sliksvn.com/en/download, command-line only) and TortoiseSVN (http://tortoisesvn.net/downloads, with Windows Explorer integration, which is really neat).
MinGW
Download and the latest automated installer from http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/ and run it. Ask for the current version (not previous or candidate). Select these components and these components only: base tools, g++ compiler, g77 compiler.
As of 2009-11-20, the current MinGW version is 5.1.6, which includes GCC 3.4.5.
tip: move the installer into an empty directory before starting it; it will download all the MinGW distribution files into that directory.
At this point, you may want to download bsdtar from http://sourceforge.net/projects/mingw/files/MinGW%20Utilities/basic%20bsdtar/bsdtar-2.7.900a_r1628-20091110/ and install bsdtar.exe
as /mingw/bin/tar
. It supports a wider range of archive formats and compression algorithms than GNU tar, and automatically detects which one to use.
MSYS
Download the MSYS installer from http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/ and run it (you will need administrator privileges). Accept the default answer to all questions.
As of 2009-11-20, the latest MSYS version is 1.0.11.
Testing the toolchain
Let's see if our C compiler works:
$ which gcc /mingw/bin/gcc.exe $ gcc --version gcc.exe (GCC) 3.4.5 (mingw-vista special r3) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat >hello.c #include <stdio.h> int main(void) { printf("Hello, C world!\n"); return 0; } ^D $ gcc -o hello hello.c $ ./hello.exe Hello, C world!
And C++:
$ which g++ /mingw/bin/g++.exe $ g++ --version g++.exe (GCC) 3.4.5 (mingw-vista special r3) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat >hello.cc #include <iostream> int main() { std::cout << "Hello, C++ world!" << std::endl; return 0; } ^D $ g++ -o hello hello.cc $ ./hello.exe Hello, C++ world!
And Fortran 77:
$ which g77 /mingw/bin/g77.exe $ g77 --version GNU Fortran (GCC) 3.4.5 (mingw-vista special r3) Copyright (C) 2004 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING or type the command `info -f g77 Copying'. $ cat >hello.f PROGRAM HELLOW WRITE(UNIT=*, FMT=*) 'Hello World' END ^D $ g77 -o hello hello.f $ ./hello.exe Hello, Fortran world!
Perl
The GNU Autotools, which we will install next, require Perl. Download and install the MSYS version of Perl from http://sourceforge.net/projects/mingw/files/MSYS%20perl/. You will also need libcrypt from http://sourceforge.net/projects/mingw/files/MSYS%20crypt/.
pkg-config
There are no MinGW or MSYS binaries for pkg-config, and building it from source is non-trivial due to a circular dependency on glib (you need pkg-config to build glib). However, the Gnome project distribute Windows binaries of both glib and pkg-config, which you can download from http://www.gtk.org/download-windows.html. They come in zip files, so you can just double-click them in Windows Explorer and copy the contents to your MinGW root (C:\MinGW
).
lex & yacc
Or rather, in our brave GNU world, flex (http://downloads.sourceforge.net/project/mingw/MSYS%20flex/flex-2.5.35-1/flex-2.5.35-1-msys-1.0.11-bin.tar.lzma) and bison (http://downloads.sourceforge.net/project/mingw/MSYS%20bison/bison-2.4.1-1/bison-2.4.1-1-msys-1.0.11-bin.tar.lzma). In addition, flex requires the GNU regex library (http://downloads.sourceforge.net/project/mingw/MSYS%20regex/regex-1.20090805-1/libregex-1.20090805-1-msys-1.0.11-dll-1.tar.lzma). Download and install as usual.
WiX
Microsoft's tool for creating installation packages: http://sourceforge.net/projects/wix/files/. Ironically, it does not come with its own installer.