Windows build prerequisites

  • Revision slug: Developer_Guide/Build_Instructions/Windows_Prerequisites
  • Revision title: Windows build prerequisites
  • Revision id: 32393
  • Created:
  • Creator: Mossop
  • Is current revision? No
  • Comment /* Microsoft Visual C++ (MSVC) */

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')}}

This document is a guide to the MozillaBuild environment, which works with the following versions of the Mozilla codebase:

  • Trunk (1.9/Firefox 3/Thunderbird 3)
  • MOZILLA_1_8_BRANCH (1.8.1.2/Firefox 2.0.0.2 or higher)
  • MOZILLA_1_8_0_BRANCH (1.8.0.10/Firefox 1.5.0.10 or higher)

It works with the following compilers:

Branch HEAD
Gecko 1.9
Firefox 3/Thunderbird 3
MOZILLA_1_8_BRANCH
Gecko 1.8.1
Firefox 2
MOZILLA_1_8_0_BRANCH
Gecko 1.8
Firefox 1.5.0.x
VC6 No Yes (Official) Yes (Official)
VC7.1 (Visual Studio 2003) Yes Yes No
VC8 (Visual Studio 2005) Yes (Official) No No
VC9 (Visual Studio 2008) Yes (Experimental) No No

For building older versions of the codebase, see the Windows build prerequisites using cygwin. If you are building very old versions of the Mozilla source code, from the 1.0 branch and earlier, follow the nmake build instructions.

Hardware Requirements

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

  • Pentium III or equivalent processor, 1GHz or better
  • 512 MB RAM, 1 GB or more recommended
  • 1.5 GB NTFS or 3 GB FAT disk space, or more
  • Windows 2000SP4 or greater

Software Requirements

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

  • Microsoft Visual C++ Tools
  • Microsoft Windows SDK(s)
  • MozillaBuild

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. The Visual C++ tools may be installed in a directory which contains spaces (the default install location is preferred).

Microsoft Visual C++ (MSVC)

Depending on what you're building, you will need to use one of several available versions of Microsoft Visual C++ (MSVC) and/or Microsoft Visual Studio. See the chart at the top of this page to ensure that the version you've selected is compatible with the branch you wish to build.

Building Gecko 1.8.1 or earlier
Projects that are built on Gecko 1.8.1 or earlier (such as Firefox 2) require that you use either Visual C++ 6 or Visual C++ 7.1 (Visual Studio 2003). You must install both the command line tools and the GUI development environment.
Building Gecko 1.9 (trunk)
Projects that are built on Gecko 1.9 (such as Firefox 3) require that you use Visual C++ 7.1 (Visual Studio 2003), Visual C++ 8 (Visual Studio 2005) or Visual C++ 9 (Visual Studio 2008). If you wish to enable jemalloc you must be using Visual Studio 2005 SP1 (service pack 1), no other version of Visual Studio will work.

Microsoft Windows SDK

is Vista SDK needed for 1.8.1 branch or earlier? No, Visual Studio .NET 2003 can compile the 1.8.1 branch natively while for Visual Studio 6 the February 2003 SDK is recommended. See {{mediawiki.internal('Windows Build Prerequisites (1.7 & 1.8 Branches)', "en")}} ~~~~ All versions of Visual Studio now require installing the Microsoft Windows Vista SDK: The Vista SDK .iso works, it's at http://www.microsoft.com/downloads/details.aspx?FamilyID=ff6467e6-5bba-4bf5-b562-9199be864d29&displaylang=en - the Windows Server 2008 SDK doesn't work yet, see below

  • You may choose not to install the Sample Code and Documentation to save space and download time
  • If you are using Windows XP, you must have Windows XP Service Pack 2 installed before installing the Vista SDK.

see bug 427765 If you are using Visual C++ 7.1 or the free Visual C++ 8 (Visual C++ 2005 Express) then you will also need to install the Microsoft Windows Server 2003 R2 Platform SDK in order to include some libraries (see {{template.Bug(427765)}} for details):

  • You need to install at least the "Windows Core SDK", "Web Workshop (IE) SDK", and the "Data Access Services (MDAC) SDK".
  • For all SDKs, you may choose not to install Sample Code and Documentation to save space and download time

A workaround is to build using only the Windows XP or Server 2003 Platform SDK by configuring using the --disable-vista-sdk-requirements option. (This option is also necessary if you are building using the MinGW compiler.) However this will disable some features such as parental controls.

Windows Server 2008 SDK (req'd by ??) The Windows SDK for Windows Server 2008 is not supported, and has been found to cause the following problems:

  • breaks the vcvars32.bat file from Visual Studio 2008
  • no longer sets the correct PATH for the .NET framework
  • causes an invalid PATH which breaks the Mozilla build

Possible workarounds are to use another SDK (the one shipped with Visual Studio 9) or to delete the vcvars32.bat file and repair your Visual Studio installation with the setup program.

MozillaBuild

The MozillaBuild package contains the other software prerequisites necessary for building Mozilla. This includes the MSYS build environment, python, NSIS, and UPX, as well as optional/useful tools such as wget, autoconf-2.13, xemacs.

Download the current MozillaBuild 1.2 package.

By default, the package installs to c:\mozilla-build. It is recommended to use the default path. The installer does not modify the Windows registry.

Note: if you are using the free Visual C++ 8 (Visual C++ 2005 Express) then you will need to replace two of the batch files (start-msvc8.bat and guess-msvc.bat) in order to avoid build errors (see {{template.Bug(427765)}} for details):

If start-msvc*.bat window disapears without any message, or blinks, then copy sh.exe to bash.exe in msys/bin or create symbolc link in directory where sh.exe exists.

Getting a command prompt for building

After the prerequisites are installed, launch one of the following batch files from the c:\mozilla-build directory:

  • start-msvc6.bat
  • start-msvc71.bat
  • start-msvc8.bat
  • start-msvc9.bat

If building in Windows Vista (or Windows XP under a LUA account), run the batch file as administrator (Right click and select 'Run as administrator') to prevent build errors.

The batch file will automatically display an MSYS command prompt window with all the appropriate environment variables set, provided the software requirements are met. All further commands should be executed in this environment.

Common Problems, Hints and Restrictions

  • The build may fail if your PATH environment variable contains quotes ("). Quotes are not properly translated when passed down to MozillaBuild sub-shells. Quotes are usually not needed so they can be removed.
  • Debugging Mozilla on Windows FAQ: Tips on how to debug Mozilla on Windows.
{{ wiki.languages( { "es": "es/Requerimientos_para_la_compilaci\u00f3n_en_Windows", "fr": "fr/Pr\u00e9alables_\u00e0_la_compilation_sous_Windows", "ja": "ja/Windows_Build_Prerequisites", "zh-cn": "cn/Windows_Build_Prerequisites" } ) }}

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><p>This document is a guide to the MozillaBuild environment, which works with the following versions of the Mozilla codebase:
</p>
<ul><li> Trunk (1.9/Firefox 3/Thunderbird 3)
</li><li> MOZILLA_1_8_BRANCH (1.8.1.2/Firefox 2.0.0.2 or higher)
</li><li> MOZILLA_1_8_0_BRANCH (1.8.0.10/Firefox 1.5.0.10 or higher)
</li></ul>
<div style="clear:both"></div>
<p>It works with the following compilers:
</p>
<table class="standard-table">
<tbody><tr>
<th scope="row">Branch
</th><th>HEAD<br>Gecko 1.9<br>Firefox 3/Thunderbird 3
</th><th>MOZILLA_1_8_BRANCH<br>Gecko 1.8.1<br>Firefox 2
</th><th>MOZILLA_1_8_0_BRANCH<br>Gecko 1.8<br>Firefox 1.5.0.x
</th></tr>
<tr>
<th>VC6
</th><td style="background-color:#ff9999"><a href="en/VC6_Build_Instructions">No</a>
</td><td style="background-color:#66ff66">Yes (Official)
</td><td style="background-color:#66ff66">Yes (Official)
</td></tr>
<tr>
<th>VC7.1 (Visual Studio 2003)
</th><td style="background-color:#66ff66">Yes
</td><td style="background-color:#66ff66">Yes
</td><td style="background-color:#ff9999">No
</td></tr>
<tr>
<th>VC8 (Visual Studio 2005)
</th><td style="background-color:#66ff66">Yes (Official)
</td><td style="background-color:#ff9999">No
</td><td style="background-color:#ff9999">No
</td></tr>
<tr>
<th>VC9 (Visual Studio 2008)
</th><td style="background-color:#66ff66">Yes (Experimental)
</td><td style="background-color:#ff9999">No
</td><td style="background-color:#ff9999">No
</td></tr></tbody></table>
<p>For building older versions of the codebase, see the <a href="en/Windows_build_prerequisites_using_cygwin">Windows build prerequisites using cygwin</a>. If you are building very old versions of the Mozilla source code, from the 1.0 branch and earlier, follow the <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 III or equivalent processor, 1GHz or better
</li><li> 512 MB RAM, 1 GB or more recommended
</li><li> 1.5 GB NTFS or 3 GB FAT disk space, or more
</li><li> Windows 2000SP4 or greater
</li></ul>
<h3 name="Software_Requirements"> Software Requirements </h3>
<p>The following software needs to be installed for a standard Windows build:
</p>
<ul><li> Microsoft Visual C++ Tools
</li><li> Microsoft Windows SDK(s)
</li><li> MozillaBuild
</li></ul>
<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. The Visual C++ tools may be installed in a directory which contains spaces (the default install location is preferred).
</p>
<h4 name="Microsoft_Visual_C.2B.2B_.28MSVC.29"> Microsoft Visual C++ (MSVC) </h4>
<p>Depending on what you're building, you will need to use one of several available versions of Microsoft Visual C++ (MSVC) and/or Microsoft Visual Studio. See the chart at the top of this page to ensure that the version you've selected is compatible with the branch you wish to build.
</p>
<dl><dt>Building Gecko 1.8.1 or earlier
</dt><dd>Projects that are built on Gecko 1.8.1 or earlier (such as Firefox 2) require that you use either Visual C++ 6 or Visual C++ 7.1 (Visual Studio 2003). You must install both the command line tools and the GUI development environment.
</dd></dl>
<ul><li> To use Visual C++ 6, you must be sure that you have applied <a class="external" href="http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp5/default.aspx">Visual Studio Service Pack 5</a> and the <a class="external" href="http://msdn.microsoft.com/vstudio/downloads/tools/ppack/">Visual C++ 6.0 Processor Pack</a>. (The processor pack is not available for Visual Studio Service Pack 6)  
</li></ul>
<dl><dt>Building Gecko 1.9 (trunk)
</dt><dd>Projects that are built on Gecko 1.9 (such as Firefox 3) require that you use Visual C++ 7.1 (Visual Studio 2003), Visual C++ 8 (Visual Studio 2005) or Visual C++ 9 (Visual Studio 2008). If you wish to enable jemalloc you must be using <a class="external" href="http://www.microsoft.com/downloads/details.aspx?familyid=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&amp;displaylang=en">Visual Studio 2005 SP1 (service pack 1)</a>, no other version of Visual Studio will work.
</dd></dl>
<ul><li> Visual C++ 9 is available free from Microsoft as part of the free <a class="external" href="http://www.microsoft.com/express/download/">Visual C++ 2008 Express Edition</a>. The optional Silverlight plugin is not required.
</li></ul>
<h4 name="Microsoft_Windows_SDK"> Microsoft Windows SDK </h4>
<p><span class="comment">is Vista SDK needed for 1.8.1 branch or earlier?</span>
<span class="comment">No, Visual Studio .NET 2003 can compile the 1.8.1 branch natively while for Visual Studio 6 the February 2003 SDK is recommended. See {{mediawiki.internal('Windows Build Prerequisites (1.7 &amp; 1.8 Branches)', "en")}} ~~~~</span>
All versions of Visual Studio now require installing the <a class="external" href="http://www.microsoft.com/downloads/details.aspx?familyid=4377F86D-C913-4B5C-B87E-EF72E5B4E065&amp;displaylang=en">Microsoft Windows Vista SDK</a>:
<span class="comment">The Vista SDK .iso works, it's at http://www.microsoft.com/downloads/details.aspx?FamilyID=ff6467e6-5bba-4bf5-b562-9199be864d29&amp;displaylang=en - the Windows Server 2008 SDK doesn't work yet, see below</span>
</p>
<ul><li> You may choose not to install the Sample Code and Documentation to save space and download time
</li><li> If you are using Windows XP, you must have <a class="external" href="http://www.microsoft.com/windowsxp/sp2/default.mspx">Windows XP Service Pack 2</a> installed before installing the Vista SDK.
</li></ul>
<p><span class="comment">see bug 427765</span>
If you are using Visual C++ 7.1 or the free Visual C++ 8 (Visual C++ 2005 Express) then you will also need to install the <a class="external" href="http://www.microsoft.com/downloads/details.aspx?familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb&amp;displaylang=en">Microsoft Windows Server 2003 R2 Platform SDK</a> in order to include some libraries (see {{template.Bug(427765)}} for details):
</p>
<ul><li> You need to install at least the "Windows Core SDK", "Web Workshop (IE) SDK", and the "Data Access Services (MDAC) SDK".
</li><li> For all SDKs, you may choose not to install Sample Code and Documentation to save space and download time
</li></ul>
<p>A workaround is to build using only the Windows XP or Server 2003 Platform SDK by configuring using the --disable-vista-sdk-requirements option. (This option is also necessary if you are building using the MinGW compiler.) However this will disable some features such as parental controls.
</p><p><span class="comment">Windows Server 2008 SDK (req'd by ??)</span>
The Windows SDK for Windows Server 2008 is not supported, and has been found to cause the following problems:
</p>
<ul><li> breaks the vcvars32.bat file from Visual Studio 2008
</li><li> no longer sets the correct PATH for the .NET framework
</li><li> causes an invalid PATH which breaks the Mozilla build
</li></ul>
<p>Possible workarounds are to use another SDK (the one shipped with Visual Studio 9) or to delete the vcvars32.bat file and repair your Visual Studio installation with the setup program.
</p>
<h4 name="MozillaBuild"> MozillaBuild </h4>
<p>The MozillaBuild package contains the other software prerequisites necessary for building Mozilla. This includes the MSYS build environment, python, NSIS, and UPX, as well as optional/useful tools such as wget, autoconf-2.13, xemacs.
</p><p><a class="external" href="http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.2.exe">Download the current MozillaBuild 1.2 package.</a>
</p><p>By default, the package installs to <code>c:\mozilla-build</code>. It is recommended to use the default path. The installer does not modify the Windows registry.
</p><p><b>Note: if you are using the free Visual C++ 8</b> (Visual C++ 2005 Express) then you will need to replace two of the batch files (start-msvc8.bat and guess-msvc.bat) in order to avoid build errors (see {{template.Bug(427765)}} for details):
</p>
<ul><li> download the revised <a class="external" href="http://people.mozilla.com/~beltzner/guess-msvc-v2.bat">guess-msvc.bat</a>
</li><li> download the revised <a class="external" href="http://people.mozilla.com/~beltzner/start-msvc8-v2.bat">start-msvc8.bat</a>
</li></ul>
<p><i>If start-msvc*.bat window disapears without any message, or blinks, then copy sh.exe to bash.exe in msys/bin or create symbolc link in directory where sh.exe exists.</i>
</p>
<h3 name="Getting_a_command_prompt_for_building"> Getting a command prompt for building </h3>
<p>After the prerequisites are installed, launch one of the following batch files from the <code>c:\mozilla-build</code> directory:
</p>
<ul><li> <code>start-msvc6.bat</code>
</li><li> <code>start-msvc71.bat</code>
</li><li> <code>start-msvc8.bat</code>
</li><li> <code>start-msvc9.bat</code>
</li></ul>
<p>If building in Windows Vista (or Windows XP under a LUA account), run the batch file as administrator (Right click and select 'Run as administrator') to <a class="external" href="http://groups.google.com/group/mozilla.dev.builds/browse_thread/thread/48cf39b25a684fb1">prevent build errors</a>.
</p><p>The batch file will automatically display an MSYS command prompt window with all the appropriate environment variables set, provided the software requirements are met. All further commands should be executed in this environment.
</p>
<h3 name="Common_Problems.2C_Hints_and_Restrictions"> Common Problems, Hints and Restrictions </h3>
<ul><li> The build may fail if your PATH environment variable contains quotes ("). Quotes are not properly translated when passed down to MozillaBuild sub-shells. Quotes are usually not needed so they can be removed.
</li><li> <a href="en/Debugging_Mozilla_on_Windows_FAQ">Debugging Mozilla on Windows FAQ</a>: Tips on how to debug Mozilla on Windows.
</li></ul>
<div class="noinclude">
</div>
{{ wiki.languages( { "es": "es/Requerimientos_para_la_compilaci\u00f3n_en_Windows", "fr": "fr/Pr\u00e9alables_\u00e0_la_compilation_sous_Windows", "ja": "ja/Windows_Build_Prerequisites", "zh-cn": "cn/Windows_Build_Prerequisites" } ) }}
Revert to this revision