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

Revision 895937 of Windows Firefox build

  • Revision slug: Simple_Firefox_build/Windows_Firefox_build
  • Revision title: Windows Firefox build
  • Revision id: 895937
  • Created:
  • Creator: mnoorenberghe
  • Is current revision? No
  • Comment link to 2015 bugs

Revision Content

This page covers the steps needed to prepare your machine to build a bleeding-edge, development version of Firefox on Windows.

Hardware requirements

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

  • A fast processor, ideally with several cores.
  • At least 2 GB of RAM, 4 GB or higher recommended.
  • 1.5 GB NTFS or 3 GB FAT disk space, or more
  • Windows Vista or later recommended (the build should work on Windows XP though).

Overview

The Mozilla build process requires many tools that are not installed on most Windows systems. In addition to Visual Studio, you must install MozillaBuild, which is a bundle of software including just the right versions of bash, GNU make, autoconf, Mercurial, and much more.

This document is a guide to the MozillaBuild environment, which works with the following versions of the Mozilla codebase available as Mercurial code repositories:

It works with the following compilers ("Official" means this is what we use for the builds we release as the Firefox product):

  VC12 (Visual Studio 2013) VC14 (Visual Studio 2015)
Firefox Yes (Official) Maybe (bug list)

Install build prerequisites

Complete each of these steps otherwise you may not be able to build successfully, there are notes on these software requirements below.

  1. Make sure your system is up-to-date through Windows Update. (Windows XP needs at least Service Pack 2 and .NET Framework 2.0.)
  2. Install a version of Visual Studio that supports C++ development: VS 2013 for Windows Desktop (free), VS 2013 Community (free), VS 2013 Pro or Express (free).
  3. You may need to install one or more Windows SDKs. See Windows SDK versions for a quick guide.
  4. Install the June 2010 DirectX SDK (optional, see #Microsoft_DirectX_SDK).
  5. Install MozillaBuild, a package of additional build tools. (If you see a Windows error dialog giving you the option to re-install with the 'correct settings', choose that option and after that all should be well.)

The rest of the build steps are done from the MSYS shell installed with MozillaBuild (the MINGW32 shell). NOTE that this is not the same as an MS-DOS CMD.EXE Shell.

Mozilla will 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).

Opening a Build Command Prompt

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

  • start-shell-msvc2013.bat (for Visual Studio 2013)
  • start-shell-msvc2015.bat (for Visual Studio 2015)
Even if you are on 64-bit Windows, do not use the start-shell-msvcNNNN-x64.bat files (unless you know what you're doing). Those files are experimental and unsupported. See the Build:MozillaBuild For x64 wiki page

This will launch a MSYS command prompt properly configured to build one of the aforementioned code bases.

All further commands should be executed in this command prompt window.

Create directory for the source

Note: You won't be able to build the Firefox source code if it's under a directory with spaces in the path (e.g. don't use "Documents and Settings"). You can pick any other location, such as a new directory C:\mozilla-central

It's a sensible idea to create a new directory dedicated solely to the code.

cd /c; mkdir mozilla-source; cd mozilla-source

Now you are ready to get the Firefox source and build, continue on from Simple Firefox build (Get_the_source).

Notes on some of the required software

Microsoft DirectX SDK

The June 2010 DirectX SDK (specifically) is required for building the ANGLE GLES-on-D3D9 renderer, which is required on Windows for WebGL rendering.  (If you don't care about compatibility with official Firefox builds and want to avoid installing this large SDK, you can disable WebGL by building Mozilla with the --disable-webgl option.)  As part of the DirectX SDK install, you must install the End-User Redistributable Packages; don't uncheck it in the installer. (At least prior to Win7+VS2012?)

(Note that other versions of the DirectX SDK on Microsoft's Developer Center that claim to have been released after June 2010 are actually older versions that are misdated, some of which will result in an error if you try and download them due to the installer files themselves having been removed from the MS servers.  There will not be any further standalone DirectX SDKs released by MS, since DirectX has been transitioned from an independent distribution model to an integrated (into Windows and Visual Studio) model, and the DirectX SDK is now integrated into the Windows 8 SDK (which is bundled with Visual Studio as of VS2012) [ref].  The reason that we require the June SDK even on newer Win7+VS2012 systems is because ANGLE depends on D3DX9, but MS considers D3DX to have been obsoleted by newer technologies and therefore VS2012 don't include the d3dx9.h and d3dx9tex.h headers that are required to compile ANGLE.  Any queries about this paragraph, talk to Jonathan Watt.)

MSDN claims that MSVC 2005 is not compatible with the June 2010 SDK, but as far as we're concerned it works for release builds. However you cannot use the compiler provided with the Vista SDK to compile debug builds at all, and you need a hotfix to be able to compile debug builds with the full MSVC 2005.

MozillaBuild

The MozillaBuild package contains the other software prerequisites necessary for building Mozilla. This includes the MSYS build environment, Mercurial, autoconf-2.13, CVS, Python, YASM, NSIS, and UPX, as well as optional but useful tools such as wget and emacs. 

Download the current MozillaBuild package.

By default, the package installs to c:\mozilla-build. It is recommended to use the default path. Don't use a path that contains spaces. The installer does not modify the Windows registry. Note that some binaries may require Visual C++ Redistributable package to run.

Expectation setting: Note that the "UNIX-like" environment provided by MozillaBuild is only really useful for building and committing to the Mozilla source. Most command line tools you would expect in a modern Linux distribution are not present, and those tools that are provided can be as much as a decade or so old (especially those provided by MSYS). It's the old tools in particular that can cause problems, since they often don't behave as expected, are buggy, or don't support command line arguments that have been taken for granted for years. For example, copying a source tree using cp -rf src1 src2 does not work correctly because of an old version of cp (it gives "cp: will not create hard link" errors for some files). In short, MozillaBuild supports essential developer interactions with the Mozilla code, but beyond that don't be surprised if it trips you up in all sorts of exciting and unexpected ways.

The MozillaBuild package includes the "make" program that originated on the UNIX and Linux platforms. This version of make does not make use of Windows' multi-core architecture. pymake is a Python implementation of Make that uses Window's multi-core architecture and thus significantly speeds up build time.

Revision Source

<p>This page covers the steps needed to prepare your machine to build a bleeding-edge, development version of Firefox on Windows.</p>

<h2 id="Hardware_requirements">Hardware requirements</h2>

<p>Mozilla takes time to build. You need a development-class system:</p>

<ul>
 <li>A fast processor, ideally with several cores.</li>
 <li>At least 2 GB of RAM, 4 GB or higher recommended.</li>
 <li>1.5 GB NTFS or 3 GB FAT disk space, or more</li>
 <li>Windows Vista or later recommended (the build should work on Windows XP though).</li>
</ul>

<h2 id="Overview">Overview</h2>

<p>The Mozilla build process requires many tools that are not installed on most Windows systems. In addition to Visual Studio, you must install MozillaBuild, which is a bundle of software including just the right versions of bash, GNU make, autoconf, Mercurial, and much more.</p>

<p>This document is a guide to the MozillaBuild environment, which works with the following versions of the Mozilla codebase available as Mercurial code repositories:</p>

<ul>
 <li><a class="internal" href="https://developer.mozilla.org/en/mozilla-central" title="en/mozilla-central">mozilla-central</a>/mozilla-aurora/mozilla-beta/mozilla-release (Firefox)</li>
 <li><a class="internal" href="https://developer.mozilla.org/en/comm-central" title="en/comm-central">comm-central</a>/comm-aurora/comm-beta/comm-release (Thunderbird)</li>
</ul>

<p>It works with the following compilers ("Official" means this is what we use for the builds we release as the Firefox product):</p>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">&nbsp;</th>
   <th scope="col">VC12 <span style="font-size:smaller">(Visual Studio 2013)</span></th>
   <th scope="col">VC14 <span style="font-size:smaller">(Visual Studio 2015)</span></th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <th scope="row">Firefox</th>
   <td style="background-color: rgb(102, 255, 102);">Yes (Official)</td>
   <td style="background-color: rgb(102, 255, 102);">Maybe (<a href="https://bugzilla.mozilla.org/showdependencytree.cgi?id=1119082&amp;hide_resolved=1">bug list</a>)</td>
  </tr>
 </tbody>
</table>

<h2 id="Install_build_prerequisites">Install build prerequisites</h2>

<p>Complete each of these steps otherwise you may not be able to build successfully, there are notes on these software requirements below.</p>

<ol>
 <li>Make sure your system is up-to-date through&nbsp;Windows Update. (Windows XP needs at least <a class="external" href="https://www.microsoft.com/windowsxp/sp2/default.mspx">Service Pack 2</a> and <a class="external" href="https://www.microsoft.com/downloads/info.aspx?na=47&amp;p=3&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=4377f86d-c913-4b5c-b87e-ef72e5b4e065&amp;u=details.aspx?familyid=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&amp;displaylang=en">.NET Framework 2.0</a>.)</li>
 <li>Install a version of Visual Studio that supports C++ development: <a class="external" href="https://www.microsoft.com/visualstudio/eng/downloads" title="https://www.microsoft.com/visualstudio/eng/downloads">VS 2013 for Windows Desktop (free)</a>, <a class="external" href="https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx">VS 2013 Community (free)</a>, VS 2013 Pro or <a class="external" href="https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx" title="https://go.microsoft.com/?linkid=9709949">Express (free)</a>.</li>
 <li>You may need to install one or more Windows SDKs. See <a class="internal" href="https://developer.mozilla.org/En/Windows_SDK_versions" title="En/Windows SDK versions">Windows SDK&nbsp;versions</a> for a quick guide.</li>
 <li>Install the <a class="external" href="https://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6812" title="https://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6812">June 2010 DirectX SDK</a>&nbsp;(optional, see&nbsp;<a href="#Microsoft_DirectX_SDK">#Microsoft_DirectX_SDK</a>).</li>
 <li>Install <a class="external" href="https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe" title="https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe">MozillaBuild</a>, a package of additional build tools. (If you see a Windows error dialog giving you the option to re-install with the 'correct settings', choose that option and after that all should be well.)</li>
</ol>

<p>The rest of the build steps are done from the MSYS shell installed with MozillaBuild (the MINGW32 shell). <strong>NOTE</strong> that this is not the same as an MS-DOS CMD.EXE Shell.</p>

<p>Mozilla will <strong>not</strong> build if some tools are installed at a path that contains <strong>spaces</strong> 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>

<h2 id="Opening_a_Build_Command_Prompt">Opening a Build Command Prompt</h2>

<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-shell-msvc2013.bat (<code>for </code>Visual Studio 2013)</code></li>
 <li><code>start-shell-msvc2015.bat (for Visual Studio 2015)</code></li>
</ul>

<div class="warning"><strong>Even if you are on 64-bit Windows, do not use the <code>start-shell-msvcNNNN-x64.bat</code> files </strong>(unless you know what you're doing). Those files are <strong>experimental</strong> and <strong>unsupported</strong>. See the <a class="external" href="https://wiki.mozilla-x86-64.com/How_To_Build_Windows_x64_Build" title="https://wiki.mozilla-x86-64.com/How_To_Build_Windows_x64_Build">Build:MozillaBuild For x64 wiki page</a>.&nbsp;</div>

<p>This will launch a MSYS&nbsp;command prompt properly configured to build one of the aforementioned code bases.</p>

<p>All further commands should be executed in this command prompt window.</p>

<h2 id="Create_directory_for_the_source">Create directory for the source</h2>

<div class="note"><strong>Note:</strong> You won't be able to build the Firefox source code if it's under a directory with spaces in the path (e.g. don't use "Documents and Settings"). You can pick any other location, such as a new directory C:\mozilla-central</div>

<p>It's a sensible idea to create a new directory dedicated solely to the code.</p>

<pre>
cd /c; mkdir mozilla-source; cd mozilla-source</pre>

<p>Now you are ready to get the Firefox source and build, continue on from <a href="/en-US/docs/Simple_Firefox_build#Get_the_source" title="/en-US/docs/Simple_Firefox_build#Get_the_source">Simple Firefox build (Get_the_source).</a></p>

<h2 id="Notes_on_some_of_the_required_software">Notes on some of the required software</h2>

<h3 id="Microsoft_DirectX_SDK">Microsoft DirectX&nbsp;SDK</h3>

<p>The <a class="external" href="https://www.microsoft.com/en-us/download/details.aspx?id=6812" title="https://www.microsoft.com/en-us/download/details.aspx?id=6812">June 2010 DirectX&nbsp;SDK</a> (specifically) is required for building the <a class="external" href="https://code.google.com/p/angleproject/" title="https://code.google.com/p/angleproject/">ANGLE</a> GLES-on-D3D9 renderer, which is required on Windows for WebGL rendering.&nbsp; (If you don't care about compatibility with official Firefox builds and want to avoid installing this large SDK, you can disable WebGL by building Mozilla with the --disable-webgl option.)&nbsp; As part of the DirectX SDK&nbsp;install, you must install the End-User Redistributable Packages; don't uncheck it in the installer. (At least prior to Win7+VS2012?)</p>

<p>(Note that other versions of the DirectX SDK on Microsoft's Developer Center that claim to have been released after June 2010 are actually <u>older</u> versions that are misdated, some of which will result in an error if you try and download them due to the installer files themselves having been removed from the MS servers.&nbsp; There will not be any further standalone DirectX SDKs released by MS, since DirectX has been transitioned from an independent distribution model to an integrated (into Windows and Visual Studio) model, and the DirectX SDK is now integrated into the Windows 8 SDK (which is bundled with Visual Studio as of VS2012) [<a class="external" href="https://blogs.msdn.com/b/chuckw/archive/2012/03/22/where-is-the-directx-sdk.aspx" title="https://blogs.msdn.com/b/chuckw/archive/2012/03/22/where-is-the-directx-sdk.aspx">ref</a>].&nbsp; The reason that we require the June SDK even on newer Win7+VS2012 systems is because ANGLE depends on D3DX9, but MS considers D3DX to have been obsoleted by newer technologies and therefore VS2012 don't include the d3dx9.h and d3dx9tex.h headers that are required to compile ANGLE.&nbsp; Any queries about this paragraph, talk to <a href="https://developer.mozilla.org/en-US/profiles/Jonathan_Watt" title="/en-US/profiles/Jonathan_Watt">Jonathan Watt</a>.)</p>

<p>MSDN claims that MSVC 2005 is not compatible with the June 2010 SDK, but as far as we're concerned it works for release builds. However you cannot use the compiler provided with the Vista SDK to compile debug builds at all, and you need a <a class="external" href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=18623" title="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=18623">hotfix</a> to be able to compile debug builds with the full MSVC&nbsp;2005.</p>

<h3 id="MozillaBuild">MozillaBuild</h3>

<p>The MozillaBuild package contains the other software prerequisites necessary for building Mozilla. This includes the MSYS build environment, <a href="https://developer.mozilla.org/en/Mercurial" title="en/Mercurial">Mercurial</a>, autoconf-2.13,&nbsp;CVS, Python, YASM, NSIS, and UPX, as well as optional but useful tools such as wget and emacs.&nbsp;</p>

<p><a class="external" href="https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe" title="https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe">Download the current MozillaBuild package.</a></p>

<p>By default, the package installs to <code>c:\mozilla-build</code>. It is recommended to use the default path. Don't use a path that contains spaces. The installer does not modify the Windows registry. Note that some binaries may require <a class="external" href="https://www.microsoft.com/downloads/en/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&amp;displaylang=en" title="https://www.microsoft.com/downloads/en/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&amp;displaylang=en">Visual C++ Redistributable package</a>&nbsp;to run.</p>

<p><strong>Expectation setting:</strong>&nbsp;Note that the "UNIX-like"&nbsp;environment provided by MozillaBuild is only really useful for building and committing to the Mozilla source. Most command line tools you would expect in a modern Linux distribution are not present, and those tools that are provided can be as much as a decade or so old (especially those provided by MSYS). It's the old tools in particular that can cause problems, since they often don't behave as expected, are buggy, or don't support command line arguments that have been taken for granted for years. For example, copying a source tree using <code>cp -rf src1 src2</code> does not work correctly because of an old version of cp (it gives "cp: will not create hard link" errors for some files). In short, MozillaBuild supports essential developer interactions with the Mozilla code, but beyond that don't be surprised if it trips you up in all sorts of exciting and unexpected ways.</p>

<p>The MozillaBuild package includes the "make" program that originated on the UNIX and Linux platforms. This version of make does not make use of Windows' multi-core architecture. <a href="https://developer.mozilla.org/en-US/docs/pymake" title="/en-US/docs/pymake">pymake</a> is a Python implementation of Make that uses Window's multi-core architecture and thus significantly speeds up build time.</p>
Revert to this revision