Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

NOTE: Do not make substantive changes to this document without consulting Benjamin Smedberg <[email protected]> or one of the build-config peers.

Introduction

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.0.*), and the 1.8 branch (Firefox 2). The build prerequisites for the Mozilla trunk are here.

Hardware Requirements

  • 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)

Software Requirements

GNU Tools for Microsoft Windows (Cygwin)

Cygwin setup

Required packages:

  • 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 3.80 (not 3.81, see below) -- 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)
  • libiconv -- character set conversion (Devel category)


If you plan to modify the build system's configure.in files, you will need to install an editor (xemacs, vim, etc.) and the autoconf-2.13 (don't use autoconf-2.5x or 2.60) package as well.

It is hightly recommended to choose "DOS" style line endings from the cygwin installer.

You may use ActivePerl from ActiveState instead of the perl package in cygwin if you prefer.

make

make 3.80 is no longer available in the cygwin installer (version 3.81 will not work), so get it from paracoda and place the included make.exe in your %cygwin%\bin\ directory, e.g. by starting a cygwin bash shell and executing

cd /
tar xjf /cygdrive/c/where-your-download-is/make-3.80-1.tar.bz2
bin/make.exe --version

Netscape wintools

If you are building the 1.8 branch or trunk (not 1.8.0 or any earlier branches, see below), you should use the special moztools-static package which has a static version of the moztools, glib, and libIDL for all MSVC versions.

The zip file contains a single folder named moztools that you should preserve. Unpack the zip file wherever you want the tools to be installed; however, Mozilla may not build if you install the moztools directory inside the cygwin directory. The MOZ_TOOLS environment variable should be set to point to this moztools folder. (You may rename the folder, as long as you update $MOZ_TOOLS accordingly.)

The moztools zip file does not contain the source for the components; if you are interested in building them from scratch, you can obtain the source here. The ooo-build system for building OpenOffice.org builds the tools from scratch using this code and contains some relevant patches for anyone who doesn't want to use the binaries provided.

If you are building the 1.8.0 branch or earlier, 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.

If you are building 1.8.0 or any earlier branch, you will have to download wintools as well as possibly an appropriate version for MSVC++ 7.

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:

set MOZ_TOOLS=C:\moztools

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

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. The static moztools package includes these libraries, so you if you're using that, you don't need to do anything more to obtain them. Otherwise, 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).

cvs

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. You must use either the Professional or Enterprise edition (the Visual C++ Processor Pack will not install with Visual C++ Standard). 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 vcvars32.bat 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.

Platform SDK

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" or (in the Feb. 2003 version) the "Internet Development SDK" (Build Environment).

Those who need an old version can find the february 2003 PSDK here. It is also possible to order CD version of several old version of the PDSK here .

The build environment must be altered to pick up the SDK paths, see the examples below.

NSIS

Some applications built from the Mozilla 1.8 branch use NSIS for their installer, notably the toolkit apps Firefox & Thunderbird 2, and Sunbird 0.3. If you will need to build the installer then setup NSIS and ensure it is on the PATH. Version 2.17 or greater is recommended.  However note that NSIS version 2.30 and later will NOT work, as it handles language macros differently from earlier versions.

7-Zip and UPX

If you want to make the highly compressed installer used by Firefox and Thunderbird, you need to install the 7-zip and UPX utilities, make sure they are in your path, and export MOZ_INSTALLER_USE_7ZIP in your environment.

The UPX package is available in Cygwin setup under the Utils category. Do not use the DOS version, as it will not work.

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 or edit the cygwin.bat file) 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 https://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
rem --- Do not use CYGWIN or else cygserver, cygrunsrv, and other cygwin services will not function properly.
rem --- The CYGWIN variable is also used to sort of change the behaviour of Cygwin.
set CYGWINBASE=C:\cygwin
rem --- Make sure Cygwin does not print out a DOS style path warning
set CYGWIN=nodosfilewarning

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 find is ahead of windows find.exe in the PATH, but cygwin link is after MSVC link.exe.
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=%MSSDK%\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
rem --- WARNING: This may reset your carefully setup path! Check your /etc/profile and ~/.profile files.
bash --login -i

Before building, be sure to rename %CYGWINBASE%\bin\link.exe to another name, for example glink.exe. If you don't, you might come up with error (in configure)

configure: error: The incremental linker version, , does not match the compiler suite version, 7.1.
Fix above errors and restart with "make -f client.mk build"

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.
  • Currently the build system is incompatible with make 3.81, so make sure you're using make 3.80. This issue is being tracked in bug 325148, where a partial patch exists.
    • From the Cygwin Mailing Lists, the cause of the change of behaviour on make 3.81 is because of a DOS style path patch removal. That patch is still on make 3.80.
  • Double-check to make sure that you have the complete cygwin package list. If not, launch the cygwin installer and add the missing packages.
  • Debugging Mozilla on Windows FAQ: Tips on how to debug Mozilla on Windows.

Document Tags and Contributors

 Last updated by: Fez,