NOTE: Do not make substantive changes to this document without consulting Benjamin Smedberg <firstname.lastname@example.org> or one of the build-config peers.
This document is a guide to the prerequisite software for building Mozilla on Windows platforms on the 1.7 branch (Mozilla 1.7), the aviary branch (Firefox 1.0), the 1.8.0 branch (Firefox 1.5), and the 1.8 branch (Firefox 2). The build prerequisites for the Mozilla trunk are here.
- Pentium or equivalent processor, 266 MHz or better, 600MHz+ recommended
- 256 MB RAM, 512 MB recommended
- 1.5 GB NTFS or 3 GB FAT disk space, or more
- Windows NT-class operating system (NT4.0, Win2k, Windows XP Professional and XP Home Edition)
GNU Tools for Microsoft Windows (Cygwin)
- ash -- UNIX-like command line interpreter shell (Base category)
- coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils) (Base category)
- diffutils -- file comparison utility (Base category)
- findutils (Base category)
- gawk -- pattern matching language (Base and Interpretors categories)
- grep -- text search tool (Base category)
- make -- dependency analyzer for software builds (Devel category)
- patchutils -- a small collection of programs that operate on patch files (Devel category)
- perl -- a scripting language used to control parts of the build (Interpreters category)
- sed -- a search and replace language (Base category)
- unzip -- zip file extraction (Archive category)
- zip -- zip file creation (Archive category)
If you plan to modify the build system's configure.in files, you will need to install the autoconf-2.13 (autoconf-stable) package as well.
It is hightly recommended to choose "DOS" style line endings from the cygwin installer.
You may use ActiveState perl instead of the perl package in cygwin if you prefer.
Netscape's wintools.zip contains pre-built libraries and tools which are needed to build Mozilla. When building with MSVC++ 7, you must install additional glib and libidl libraries, see below.
Unpack the zip file into a temporary directory, open a Windows command window, and set MOZ_TOOLS to the directory you want the build tools installed to, for example:
The MOZ_TOOLS directory should not be inside your cygwin installation directory, nor in a subdirectory of cygwin. This will cause your build to fail.
Run the wintools install script. This batch script will install the files into %MOZ_TOOLS%/bin.
cd buildtools\windows install.bat
A special moztools-static package is available which has a static version of the moztools, glib, and libIDL for all MSVC versions. This moztools-static package only works on the 1.8 branch and trunk, not 1.8.0 or any earlier branches.
glib/libIDL for MSVC7/7.1
When building with MSVC++ 7 or 7.1, you must install pre-built versions of the glib & libIDL libraries. You can find the prebuilt versions of these libraries on the mozilla.org FTP servers. Do NOT install these libraries over your existing moztools directory; instead, pick a separate location and set GLIB_PREFIX, LIBIDL_PREFIX, and PATH appropriately in your environment (see below).
To pull Mozilla sources, cvs version 1.11 or higher is required. Cygwin CVS is recommended. When installing CVS, you should also install an editor such as emacs.
Compiler & Linker
The standard compiler for Mozilla on Windows is Microsoft Visual C++, version 6. The GUI tools of the MSVC environment are not used, only the command-line tools CL (C/C++ compiler), LINK (linker), RC (resource compiler), and ML (assembler). Visual C++ Service Pack 5 and Visual C++ Processor Pack are required. Service Pack 6 is not supported. MSVC version 5 is not supported.
The environment must be configured to include the MSVC tools. This is typically with the <tt>vcvars32.bat</tt> script, see below for details.
It is also possible to compile these branches using newer Microsoft visual C++ compilers such as edition 2002 (VC7.0), 2003 (VC7.1). Using version 2005 (VC8) is not possible.
It is also possible (but not recommended) to compile Mozilla using the mingw gcc compiler: see Compiling Mozilla with mingw.
If you are using at least Visual Studio .NET 2003, you already have all the necessary SDKs for building mozilla and can skip this requirement step. For older compilers, you need to download SDKs from Microsoft to have the GDI+ headers and library.
When using Visual C++ 6, you need to get either the october 2002 or the february 2003 version of the platform SDK. The latest versions can not be used with Visual C++ 6 at all, and some intermediate versions have incompatible debug information, allowing only the release mode to work properly. In fact, even the version of february 2003 has one debug file that is incompatible with Visual C++ 6, but this does not impact mozilla.
The Platform SDK can be obtained from the Microsoft Download Center. You must install the "Windows Core SDK" (Tools, Build Environment, and Redistributable Components) and the "Web Workshop SDK" (Build Environment).
Configure the Environment
The build environment must be configured so that the mozilla build system can find the proper compiler and libraries. This is best done with a DOS batch script. Your build may fail if your paths have spaces or other special characters. Make sure that you did not install software into locations with such paths, except Visual C++.
The following is a batch script (run with cmd.exe) which should be used to configure environment variables:
rem --- Set HOME so that cvs and ssh work correctly rem --- cvs uses HOME to locate your .cvspass file, and ssh to locate your .ssh file rem --- if you are using ssh, your HOME should match the home directory specified in /etc/passwd. See http://www.cygwin.com/faq/faq0.html. set HOME=C:\home rem --- Set VCVARS to wherever the MSVC vcvars.bat file is found set VCVARS=C:\Program Files\Microsoft Visual Studio 6\VC98\Bin\VCVARS32.BAT rem --- Set MSSDK to wherever the MS SDK is installed rem --- The separate SDK is only required for MSVC6 set MSSDK=C:\Program Files\Microsoft Platform SDK rem --- Set MOZ_TOOLS to wherever you have the moztools packaged installed set MOZ_TOOLS=C:\moztools rem --- Set CYGWINBASE to wherever cygwin is installed set CYGWINBASE=C:\cygwin rem --- If you are using VC7 or VC7.1, you must set GLIB_PREFIX and LIBIDL_PREFIX set GLIB_PREFIX=C:\moztools_vc71 set LIBIDL_PREFIX=C:\moztools_vc71 rem --- Prepend Cygwin path rem --- This is necessary so that cygwin <tt>find</tt> is ahead of windows <tt>find.exe</tt> in the PATH, but cygwin <tt>link</tt> is after MSVC <tt>link.exe</tt>. rem PATH=%CYGWINBASE%\bin;%PATH% rem --- Set MSVC environment vars call "%VCVARS%" rem --- Prepend SDK paths rem --- Only required for MSVC6 set PATH=%MSSDK%\bin;%PATH% set INCLUDE=%MSSDK%\include;%INCLUDE% set LIB=%MSDDK%\lib;%LIB% rem --- Add glib/libidl to build environment rem --- Only needed for VC7 or 7.1 set PATH=%PATH%;%GLIB_PREFIX%;%GLIB_PREFIX%\bin set INCLUDE=%GLIB_PREFIX%\include;%INCLUDE% set LIB=%GLIB_PREFIX%\lib;%LIB% rem -- moztools comes last after glib/libIDL set PATH=%PATH%;%MOZ_TOOLS%\bin rem --- Now the PATH variable contains: rem MS-SDK; MSVC; Cygwin; Windows; glib/libIDL; Moztools rem --- Typically the last thing the script does is launch a cygwin shell bash --login -i
Common Problems and Hints
- Check the Mozilla Build Frequently Asked Questions
- Your source tree must be located at a /cygdrive/<c> mount point. It must not be located within your /home.
- Mozilla may not build if you install the wintools directory inside the cygwin directory.
- If the configure or build fails due to a missing w32api, add the mingw32's /include directory to the end of your INCLUDE environment variable. Mingw32 libraries or binaries should not be needed, only the headers.
- The build may fail if your PATH environment variable contains quotes ("). Quotes are not properly translated when passed down to the cygwin sub-shells. Quotes are usually not needed so they can be removed.
- Double-check to make sure that you have the complete cygwin package list. If not, launch the cygwin installer and add the missing packages.
- Win32 Debugging FAQ: Tips on how to debug Mozilla on Windows.