Compiling Open Source Programs using MinGW/MSYS

MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.

I was looking at an open source program(TCL/TK) recently and decided to try compiling it from source. I checked out the Tclers wiki and it had instructions for several different programming environments. In the past I had mixed success using Microsoft’s Visual Studio Express and Cygwin environments to compile open source software. Getting pre-made binaries is so much easier! Since I was feeling adventuresome, I opted for the MinGW/MSYS environment. I was looking for a lean, mean open source compiling machine.

Using the latest mingw-get-inst version the installation of MinGW/MSYS was pretty simple and quick. Then I followed the Building Tcl/Tk with Mingw instructions. Since I had already installed MinGW/MSYS, I skipped the part of the instructions that installed it. Within a couple of minutes I had a compiled version of TCL/TK. I believe I installed the MingGW/MSYS environment and compiled TCL/TK in a shorter time than I would have spent installing Visual Studion Express.Winking smile

Since this compiling test went so well I was curious whether I could repeat this feat on a slightly more difficult animal, OpenSSL. The INSTALL.W32 had sufficient instructions to compile the program but I had to do it twice. MinGW/MSYS is almost Linux. The problem I ran into was that it does not handle symbolic links very well. The note said it was essential that you use MSYS to unpack the source and they were right.  Fortunately the "configure" stage fixes the problem. Everything went well except that I got a statically linked executable and I did not see the shared libraries, libeay32.dll and ssleay32.dll.  It took me a little more looking before I figured out how to create the libraries. In my case I used the command, "perl Configure mingw shared –prefix=/c/OpenSSL", to re-create the executable and shared libraries. If you looking for a lean environment to create windows binaries from open source programs, this environment is attractive. It is fast, uses the standard GNU compilers, and is free.