- Up - | Next >> |
Cygwin
From Version 1.2.1, Mozart can be built natively under Windows using the Cygwin environment. Cygwin is a Unix environment for Windows. In particular, it provides a C++ compiler (gcc), a Bourne-compatible shell (bash), and all the usual Unix command line tools. Cygwin can be obtained for free at http://www.cygwin.com/.
Take yourself to a Windows machine (Windows XP Professional, Windows 2000 or Windows NT 4 are preferred, though others may work) and install Cygwin (full installation preferred), then start a shell. Make sure that uname -r
displays at least version 1.3.5. It is a good idea that you familiarize yourself with this environment, as you'll be using it for a while before your Mozart build is finished. I recommend that you read the ``Cygwin User's Guide''.
Cygwin Basics
As you will have seen on the Cygwin web site, Cygwin actually consists of two parts: A DLL providing a significant part of the Unix API, and a collection of tools. The tools we need, the DLL we do not want. By default, all executables created by gcc require the Cygwin DLL (cygwin1.dll
). This DLL provides the Unix emulation functionality, such as support for Cygwin-style file names (you do not know what this is? Read the User's Guide!) and mount points. If we built Mozart against this DLL, then we would need to ship it with Mozart (so that Mozart works on systems which do not have Cygwin installed). We do not want to ship it, and we do not need the Unix emulation, and we want to be a ``native'' Windows application, so we will use the -mno-cygwin
flag to gcc throughout the build process. This flag in fact instructs gcc to act as a cross-compiler: the host environment being Windows with Cygwin, the target environment being native Windows. This cross-compiler is called MinGW, which is also available as a standalone product and as a cross-compiler hosted on Linux.
Headers and Libraries
Object files and libraries built for Cygwin do not work with object files and libraries built for MinGW. Instead of the header files in /usr/include/
and the libraries in /usr/lib/
, gcc -mno-cygwin
therefore uses the header files from /usr/include/mingw/
and the libraries from /usr/lib/mingw/
. Instead of the Cygwin DLL, MinGW links executables against the Microsoft Visual C/C++ Runtime (msvcrt.dll
), which we can redistribute with Mozart.
Mozart requires several packages. Even though some of these are provided with Cygwin, they are built for Cygwin, and we need them built for MinGW. So before we can actually start on the Mozart sources, we will build these additional packages. Thankfully we need to do this only once.
- Up - | Next >> |