Windows build prerequisites

  • Revision slug: Developer_Guide/Build_Instructions/Windows_Prerequisites
  • Revision title: Windows build prerequisites
  • Revision id: 32171
  • Created:
  • Creator: Benjamin Smedberg
  • Is current revision? No
  • Comment /* Compiler & Linker */

Revision Content

NOTE: Do not make substantive changes to this document without consulting Benjamin Smedberg <benjamin@smedbergs.us> or one of the build-config peers.

{{wiki.template(':en/Build_Documentation/TOC')}}

Introduction

This document is a guide to building Mozilla on Windows platforms. The Windows build uses a UNIX emulator for Windows, cygwin, to control the build process.

If you are building old versions of the Mozilla source code, from the 1.0 branch and earlier, read and follow the historical nmake build instructions.

Hardware Requirements

Mozilla takes time to build. You need a development-class system:

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

Software Requirements

The following software needs to be installed for a standard Windows build.

Mozilla may not build if some tools are installed at a path that contains spaces or other breaking characters such as pluses, quotation marks, or meta characters. This does not apply to Visual C++ tools.

GNU Tools for Microsoft Windows (Cygwin)

cygwin is a UNIX-like environment for Windows. Mozilla uses a developer set of cygwin packages, which must be installed. These include gawk, make and zip utilities. GCC is not used and does not need to be installed.

You must have cygwin 1.1.6 or higher. b20.x will not build Mozilla.

Go to http://www.cygwin.com/ and follow the installation instructions. The cygwin installer wizard runs as a Windows program. One page of the wizard presents an outline view of categories and packages. You must add packages beyond the default set.

If you'll be using cygwin only to build Mozilla, then install only the default packages and the packages needed by Mozilla. In the version of the installer current at this writing, the non-default packages are found under the categories Devel, Interpreters, and Archive: make (under Devel), perl and gawk (under Interpreters), and unzip and zip (under Archive).

If you may be using cygwin's UNIX-like tools for additional development, then install the editors, developer tools and interpreters, as well as anything else that looks interesting. Make sure you get all the packages Mozilla needs too, such as unzip and zip!

Here is the complete cygwin package list for building Mozilla. You can use it to double-check your packages, or to understand and customize the build process:

  • ash -- UNIX-like command line interpreter shell
  • coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils)
  • diffutils -- file comparison utility
  • findutils
  • gawk -- pattern matching language (Devel category)
  • grep -- text search tool
  • make -- dependency analyzer for software builds (Devel category)
  • patchutils -- a small collection of programs that operate on patch files
  • perl -- a scripting language used to control parts of the build (Interpreters category)
  • sed -- a search and replace language
  • 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 wintools

Netscape's wintools.zip contains pre-built libraries and tools which are needed to build Mozilla.

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

cvs

CVS is the source control system used by Mozilla. You do not need cvs if you are only going to build from source tarballs downloaded via FTP. If so, you may skip this step.

To pull Mozilla sources, cvs version 1.11 or higher is required. Cygwin CVS is recommended; WinCVS is also tested. When installing cygwin 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 or later. It is also possible to compile Mozilla using the mingw gcc compiler: see Compiling Mozilla With Mingw.

The GUI tools of the MSVC environment are not used, only the command-line tools CL (C/C++ compiler), LINK (linker), and RC (resource compiler). Version 5 is not supported.

Version 6 requires installation of the Visual C++ Service Pack 5 and Visual C++ Processor Pack. Service Pack 6 is not supported.

Make sure you have set up the compiler using the vcvars32.bat script that came with it. Run this file from the Windows command line shell.

When building with MSVC++ 7, you must install VC7 built versions of the glib & libIDL libraries. You can find the prebuilt VC7 versions of these libraries at ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/. It is recommended that you do NOT install these libraries over your existing moztools directory; instead, pick a separate location, set GLIB_PREFIX & LIBIDL_PREFIX appropriately in your MOZCONFIG file or in your environment, and set your PATH appropriately so that the libraries are used at runtime:

# Example mozconfig entry
GLIB_PREFIX=c:/apps/vc7
LIBIDL_PREFIX=c:/apps/vc7
PATH=/cygdrive/c/apps/vc7/bin/:$PATH

Microsoft now has published Microsoft Visual C++ Toolkit for free; there are two guides, unofficial build instructions or Millie from #seamonkey Unofficial Setup Guide for MSVC++ Toolkit 2003 available for building Mozilla using this toolkit; please check the license restrictions carefully when installing software.

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.

The Platform SDK can be obtained from the Platform SDK Update site. Both the "Core SDK" and "Internet Development SDK" are required.

In order for the build environment to pick up this SDK, the following needs to be added to the environment (see below):

set PATH=C:\Program Files\Microsoft SDK\bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDK\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDK\lib;%LIB%

Configure the Environment

Both the cygwin and MSVC++ tools are controlled by environment variables which specify options, directories, and search paths. cygwin inherits Windows environment variables and maps them into its own UNIX-style file system name space, so there are a variety of places you can set the variables. To build in cygwin, you can set both types in cygwin.bat at the root of the cygwin directory. To build from the Windows command shell, you may set these in a configuration file or in "My Computer -> Properties -> Advanced -> Environment Variables".

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 environment variables must be set:

MOZ_TOOLS=C:\moztools
Set to the place where you want Netscape's wintools.zip to install its binaries. Mozilla will not build if you install the wintools directory inside the cygwin directory. The build looks for MOZ_TOOLS\include\glib.h, so make sure that the glib.h from the Windows Build Tools package resides there.

PATH=%PATH%;%MOZ_TOOLS%\bin;c:\cygwin\bin
Include both the Netscape wintools and the cygwin UNIX-like tools in your command search path.

Note: To avoid problems with a cygwin utility called "link", the MSVC binaries should be in the PATH before cygwin/bin.

Note: For .NET/VC7 users: %GLIB_PREFIX%/bin and %LIBIDL_PREFIX%/bin must be in your path before %MOZ_TOOLS%/bin.

HOME=C:\home
HOME is not needed if you are not using cvs. If you are, set it to the place where you want cvs to create your .cvspass file. By setting HOME, you tell cvs to use the same .cvspass file whether you use the Windows shell or a cygwin shell. Because cygwin cvs or other cygwin programs may use this variable, it should not contain breaking characters.

Note: if you are using ssh, your HOME should match the home directory specified in /etc/passwd. See the cygwin FAQ.

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

Revision Source

<p><span class="comment">NOTE: Do not make substantive changes to this document   without consulting Benjamin Smedberg &lt;benjamin@smedbergs.us&gt;   or one of the build-config peers.</span>
</p><p>{{wiki.template(':en/Build_Documentation/TOC')}}
</p>
<h3 name="Introduction"> Introduction </h3>
<p>This document is a guide to building Mozilla on Windows platforms. The Windows build uses a UNIX emulator for Windows, cygwin, to control the build process.
</p><p>If you are building old versions of the Mozilla source code, from the 1.0 branch and earlier, read and follow the historical <a class="external" href="http://www.mozilla.org/build/win32-nmake.html">nmake build instructions</a>.
</p>
<h3 name="Hardware_Requirements"> Hardware Requirements </h3>
<p>Mozilla takes time to build. You need a development-class system:
</p>
<ul><li> Pentium or equivalent processor, 266 MHz or better, 600MHz+ recommended
</li><li> 256 MB RAM, 512 MB recommended
</li><li> 1.5 GB NTFS or 3 GB FAT disk space, or more
</li><li> Windows NT-class operating system (NT4.0, win2k, winXP)
</li></ul>
<h3 name="Software_Requirements"> Software Requirements </h3>
<p>The following software needs to be installed for a standard Windows build.
</p><p>Mozilla may not build if some tools are installed at a path that contains spaces or other breaking characters such as pluses, quotation marks, or meta characters. This does not apply to Visual C++ tools.
</p>
<h4 name="GNU_Tools_for_Microsoft_Windows_.28Cygwin.29"> GNU Tools for Microsoft Windows (Cygwin) </h4>
<p>cygwin is a UNIX-like environment for Windows. Mozilla uses a developer set of cygwin packages, which must be installed. These include gawk, make and zip utilities. GCC is not used and does not need to be installed.
</p><p>You must have cygwin 1.1.6 or higher. b20.x will not build Mozilla.
</p><p>Go to http://www.cygwin.com/ and follow the installation instructions. The cygwin installer wizard runs as a Windows program. One page of the wizard presents an outline view of categories and packages. You must add packages beyond the default set.
</p><p>If you'll be using cygwin only to build Mozilla, then install only the default packages and the packages needed by Mozilla. In the version of the installer current at this writing, the non-default packages are found under the categories Devel, Interpreters, and Archive: make (under Devel), perl and gawk (under Interpreters), and unzip and zip (under Archive).
</p><p>If you may be using cygwin's UNIX-like tools for additional development, then install the editors, developer tools and interpreters, as well as anything else that looks interesting. Make sure you get all the packages Mozilla needs too, such as unzip and zip!
</p><p>Here is the complete cygwin package list for building Mozilla. You can use it to double-check your packages, or to understand and customize the build process:
</p>
<ul><li> ash -- UNIX-like command line interpreter shell
</li><li> coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils)
</li><li> diffutils -- file comparison utility
</li><li> findutils
</li><li> gawk -- pattern matching language (Devel category)
</li><li> grep -- text search tool
</li><li> make -- dependency analyzer for software builds (Devel category)
</li><li> patchutils -- a small collection of programs that operate on patch files
</li><li> perl -- a scripting language used to control parts of the build (Interpreters category)
</li><li> sed -- a search and replace language
</li><li> unzip -- zip file extraction (Archive category)
</li><li> zip -- zip file creation (Archive category)
</li></ul>
<p>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.
</p><p>It is hightly recommended to choose "DOS" style line endings from the cygwin installer.
</p><p>You may use <a class="external" href="http://activestate.com/Products/ActivePerl/">ActiveState perl</a> instead of the perl package in cygwin if you prefer.
</p>
<h4 name="Netscape_wintools"> Netscape wintools </h4>
<p>Netscape's <a class="external" href="http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip">wintools.zip</a> contains pre-built libraries and tools which are needed to build Mozilla.
</p><p>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:
</p>
<pre class="eval">set MOZ_TOOLS=C:\moztools
</pre>
<p>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.
</p><p>Run the wintools install script. This batch script will install the files into %MOZ_TOOLS%/bin.
</p>
<pre class="eval">cd buildtools\windows
install.bat
</pre>
<h4 name="cvs"> cvs </h4>
<p>CVS is the source control system used by Mozilla. You do not need cvs if you are only going to build from source tarballs downloaded via FTP. If so, you may skip this step.
</p><p>To pull Mozilla sources, cvs version 1.11 or higher is required. Cygwin CVS is recommended; <a class="external" href="http://www.wincvs.org/download.html">WinCVS</a> is also tested. When installing cygwin CVS, you should also install an editor such as emacs.
</p>
<h4 name="Compiler_&amp;_Linker"> Compiler &amp; Linker </h4>
<p>The standard compiler for Mozilla on Windows is Microsoft Visual C++, version 6 or later. It is also possible to compile Mozilla using the mingw gcc compiler: see <a href="en/Compiling_Mozilla_With_Mingw">Compiling Mozilla With Mingw</a>.
</p><p>The GUI tools of the MSVC environment are not used, only the command-line tools CL (C/C++ compiler), LINK (linker), and RC (resource compiler). Version 5 is not supported.
</p><p>Version 6 requires installation of the <a class="external" href="http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.aspx">Visual C++ Service Pack 5</a> and <a class="external" href="http://msdn.microsoft.com/vstudio/downloads/tools/ppack/download.asp">Visual C++ Processor Pack</a>. Service Pack 6 is not supported.
</p><p>Make sure you have set up the compiler using the vcvars32.bat script that came with it. Run this file from the Windows command line shell.
</p><p>When building with MSVC++ 7, you must install VC7 built versions of the glib &amp; libIDL libraries. You can find the prebuilt VC7 versions of these libraries at ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/. It is recommended that you do NOT install these libraries over your existing moztools directory; instead, pick a separate location, set GLIB_PREFIX &amp; LIBIDL_PREFIX appropriately in your MOZCONFIG file or in your environment, and set your PATH appropriately so that the libraries are used at runtime:
</p>
<pre class="eval"># Example mozconfig entry
GLIB_PREFIX=c:/apps/vc7
LIBIDL_PREFIX=c:/apps/vc7
PATH=/cygdrive/c/apps/vc7/bin/:$PATH
</pre>
<p>Microsoft now has published <a class="external" href="http://msdn.microsoft.com/visualc/vctoolkit2003/">Microsoft Visual C++ Toolkit</a> for free; there are two guides, <a class="external" href="http://whereswalden.com/mozilla/msvcfree/">unofficial build instructions</a> or <a class="external" href="http://seamonkey.millie.us.eu.org:8080/">Millie from #seamonkey Unofficial Setup Guide for MSVC++ Toolkit 2003</a> available for building Mozilla using this toolkit; please check the license restrictions carefully when installing software.
</p>
<h4 name="Platform_SDK"> Platform SDK </h4>
<p>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.
</p><p>The Platform SDK can be obtained from the Platform SDK Update site. Both the "Core SDK" and "Internet Development SDK" are required.
</p><p>In order for the build environment to pick up this SDK, the following needs to be added to the environment (see below):
</p>
<pre class="eval">set PATH=C:\Program Files\Microsoft SDK\bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDK\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDK\lib;%LIB%
</pre>
<h3 name="Configure_the_Environment"> Configure the Environment </h3>
<p>Both the cygwin and MSVC++ tools are controlled by environment variables which specify options, directories, and search paths. cygwin inherits Windows environment variables and maps them into its own UNIX-style file system name space, so there are a variety of places you can set the variables. To build in cygwin, you can set both types in cygwin.bat at the root of the cygwin directory. To build from the Windows command shell, you may set these in a configuration file or in "My Computer -&gt; Properties -&gt; Advanced -&gt; Environment Variables".
</p><p>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++.
</p><p>The following environment variables must be set:
</p><p></p><dl>
<dt>MOZ_TOOLS=C:\moztools
</dt><dd>Set to the place where you want Netscape's wintools.zip to install its binaries. Mozilla will not build if you install the wintools directory inside the cygwin directory. The build looks for MOZ_TOOLS\include\glib.h, so make sure that the glib.h from the Windows Build Tools package resides there.
<p></p></dd><dt>PATH=%PATH%;%MOZ_TOOLS%\bin;c:\cygwin\bin
</dt><dl>Include both the Netscape wintools and the cygwin UNIX-like tools in your command search path.
<p>Note: To avoid problems with a cygwin utility called "link", the MSVC binaries should be in the PATH <b>before</b> cygwin/bin.
</p><p>Note: For .NET/VC7 users: %GLIB_PREFIX%/bin and %LIBIDL_PREFIX%/bin must be in your path <b>before</b> %MOZ_TOOLS%/bin.
</p><p></p><dt>HOME=C:\home
</dt><dd>HOME is not needed if you are not using cvs. If you are, set it to the place where you want cvs to create your .cvspass file. By setting HOME, you tell cvs to use the same .cvspass file whether you use the Windows shell or a cygwin shell. Because cygwin cvs or other cygwin programs may use this variable, it should not contain breaking characters.
<p>Note: if you are using ssh, your HOME should match the home directory specified in /etc/passwd. See <a class="external" href="http://www.cygwin.com/faq/faq0.html">the cygwin FAQ</a>.
</p><p></p></dd></dl>

<h3 name="Common_Problems_and_Hints"> Common Problems and Hints </h3>
<ul>

<li>Check the <a href="en/Mozilla_Build_FAQ">Mozilla Build Frequently Asked Questions</a>

</li><li>Your source tree must be located at a /cygdrive/&lt;c&gt; mount point. It must not be located within your /home.

</li><li>Mozilla may not build if you install the wintools directory inside the cygwin directory.

</li><li>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.

</li><li>Double-check to make sure that you have the complete cygwin package list. If not, launch the cygwin installer and add the missing packages.

</li><li><a class="external" href="http://www.mozilla.org/build/win32-debugging-faq.html">Win32 Debugging FAQ</a>: Tips on how to debug Mozilla on Windows.</li></ul>
<p></p></dl>
Revert to this revision