mozilla

Revision 326931 of Windows build prerequisites

  • Revision slug: Developer_Guide/Build_Instructions/Windows_Prerequisites
  • Revision title: Windows build prerequisites
  • Revision id: 326931
  • Created:
  • Creator: Oeekker
  • Is current revision? No
  • Comment Added alternative on how to paste under windows

Revision Content

Introduction

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:

  • mozilla-central/mozilla-aurora/mozilla-beta/mozilla-release (Firefox 4 and later)
  • mozilla-1.9.2 (1.9.2/Firefox 3.6)
  • tracemonkey
  • comm-central/comm-aurora/comm-beta/comm-release (Thunderbird 5/SeaMonkey 2.1 and later)
  • comm-1.9.2 (Thunderbird 3.1)

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

  VC8 (Visual Studio 2005) VC9 (Visual Studio 2008) VC10 (Visual Studio 2010) VC11 (Visual Studio 2012)
mozilla-1.9.2/comm-1.9.2
Gecko 1.9.2
Firefox 3.6
Yes (Official) Yes No No
mozilla-central/tracemonkey/comm-central
Gecko 2 & later
Firefox 4 & later
Yes1 (Official) Yes Yes ??? 2
Firefox 13 & later Yes Yes Yes (Official) Yes

For building older versions of the codebase, see the Windows build prerequisites (1.9.0/1.9.1 branches) and 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.
1VC8 SP1 (service pack 1) is now required.

2Note that installing both Visual Studio 2010 and Visual Studio 2012 on Windows 64-bit currently seems to break the build. See Bug 772989 Comments 15 and 17 for a possible workaround.

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

Software requirements

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

  • Microsoft Visual C++ tools
  • Microsoft Windows SDK(s) if using certain MSVS versions
  • MozillaBuild
  • Microsoft DirectX SDK (optional)

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

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 want to build.

If you want to enable jemalloc, you must be using Visual Studio 2012, Visual Studio 2010 SP1, Visual Studio 2010, Visual Studio 2008 SP1 or Visual Studio 2005 SP1.  Other versions of Visual Studio will not work.
  • Visual Studio 2012 Express for Windows Desktop is available free from Microsoft.
  • Visual C++ 10 is available from Microsoft as part of the free Visual C++ 2010 Express Edition.
  • Visual C++ 9 is available from Microsoft as part of the free Visual C++ 2008 Express Edition with SP1 (make sure you get this and not the one without SP1!). You do not need to install the Silverlight runtime or the SQL Server 2008 Express Edition when offered. Alternatively you can install the command-line compiler as part of the Windows 7 SDK, but you are then expected to use the included WinDbg debugger.
  • The Visual C++ 8 command-line compiler is included with the Vista SDK, but you are then expected to use the included WinDbg debugger.

Microsoft Windows SDK

See Windows SDK versions.

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

Opening a Build Command Prompt

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

  • start-msvc8.bat  (VS 2005)
  • start-msvc9.bat  (VS 2008)
  • start-msvc10.bat (VS 2010)
  • start-msvc11.bat (VS 2012)
Even if you are on 64-bit Windows, do not use the start-msvcX-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. Read on for some tips and caveats, or continue now with the build steps outlined at Build Documentation (probably with getting the source code).

Command Prompt Tips and Caveats

  • To paste into this window, you must right-click on the window's title bar, move your cursor to the Edit menu and click Paste. You can also set Quick Edit Mode in the Properties menu and use a right-click in the window to paste your selection.
  • If you have cygwin installed, make sure that the MozillaBuild directories come before any cygwin directories in the search path (use echo $PATH to see your search path).
  • In the MSYS shell, the c: drive looks like a directory called c under the root directory (/). So if you want to change to the directory c:\mydir, in the MSYS shell you would use cd /c/mydir  Note the UNIX-style forward slashes (/) in the prompt instead of the Windows-style backward slashes (\)
  • The MSYS root directory is located in c:\mozilla-build\msys if you used the default installation directory. It's a good idea not to build anything under this directory. Instead use something like /c/mydir.

Common problems, hints and restrictions

  • Debugging Mozilla on Windows FAQ: Tips on how to debug Mozilla on Windows.
  • 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.
  • The build may fail if you have a PYTHON environment variable set. You will see an error almost immediately that says "The system cannot find the file specified". In a cmd-shell typing "SET PYTHON=" before running mozilla build tools in that same shell should fix this.
  • Prior to Gecko 5.0 {{ geckoRelease("5.0") }}, your OBJDIR (build directory) cannot be within the MSYS root directory. If you try this, you will see linker failures (for example, if you are building into /mydir/some/path, it will complain about being unable to find mydir:\some\path).
  • The build may fail if you have cygwin installed. Make sure that the MozillaBuild directories (c:\mozilla-build and subdirectories) come before any cygwin directories in your PATH environment variable. If this does not help, remove the cygwin directories from PATH, or try building on a clean PC with no cygwin.
  • Building with versions of NSIS other than the version that comes with the latest supported version of MozillaBuild is not supported and will likely fail.
  • If you're building on VS2005 and the build fails with the error message "C2118: negative subscript" on win_util.cc, you need to install the VS2005 Service Pack 1. Furthermore, if you get "LNK1103: debugging information corrupt", try installing this hotfix: http://support.microsoft.com/kb/949009
  • If you intend to distribute your build to others, you will need to set WIN32_REDIST_DIR=$VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT in your mozconfig to get the Microsoft CRT DLLs packaged along with the application.
    • Prior to Gecko 9 (FF 9, SM 2.6, TB 9) , this was needed only if you had not built with --enable-jemalloc.
  • The Microsoft Antimalware service can interfere with compilation, often manifesting as an error related to conftest.exe during build.  To remedy this, add at least your object directory to the exclusion settings.
  • If you encounter an error that atlbase.h cannot be found and you have installed Visual Studio 10 Express together with the platform SDK, you may have to delete a registry entry so that guess-msvc.bat doesn't detect VC10 installed. The key is HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC.
  • If you encounter an error like "second C linkage of overloaded function '_interlockedbittestandset' not allowed", it happens when intrin.h and windows.h are included together. Use a #define to redefine one instance of the function's name. See more on using intrin.h.

{{ Warning("If you follow the below advice, your computer will not be protected against attacks that exploit this vulnerability. Make sure you take adequate precautions.") }}

  • If you still get random crashes when running MAKE, you may be encountering interference from Windows Security Updates that prevent proper operation of the Bash shell on some Windows systems.  In this case, if you're on Windows XP, you will need to uninstall Windows XP Security Updates KB933729 and KB970238 using Add or Remove Programs from the Control Panel.  The first of these Security Updates is also incorporated into Windows XP Service Pack 3 (KB936929), so if you have already installed SP3 you'll need to uninstall it and then make sure that Service Pack 2, including all Windows updates (EXCEPT KB933729, KB936929 and KB970238) get installed.  To prevent these updates from being installed automatically, select "Notify me but don't automatically download or install them" in the Control Panel's "Automatic Updates" dialog.  Then de-select them when any of these items appear in the list of recommended updates, and when asked, indicate that you don't want to be asked about these de-selected updates in the future.
  • Parallel builds (-jN) do not work with GNU make on Windows. You need to use pymake instead.

Return to the Build Documentation

{{ languages( { "de": "de/Entwicklerhandbuch/Build_Anweisungen/Windows_Build_Voraussetzungen", "es": "es/Requerimientos_para_la_compilación_en_Windows", "fr": "fr/Préalables_à_la_compilation_sous_Windows", "ja": "ja/Windows_Build_Prerequisites", "zh-cn": "cn/Windows_Build_Prerequisites" } ) }}

Revision Source

<!-- NOTE: Do not make substantive changes to this document without consulting Benjamin Smedberg <benjamin@smedbergs.us> or one of the build-config peers. -->
<h2 id="Introduction">Introduction</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="/en/mozilla-central" title="en/mozilla-central">mozilla-central</a>/mozilla-aurora/mozilla-beta/mozilla-release (Firefox 4 and later)</li>
  <li>mozilla-1.9.2 (1.9.2/Firefox 3.6)</li>
  <li>tracemonkey</li>
  <li><a class="internal" href="/en/comm-central" title="en/comm-central">comm-central</a>/comm-aurora/comm-beta/comm-release (Thunderbird 5/SeaMonkey 2.1 and later)</li>
  <li>comm-1.9.2 (Thunderbird 3.1)</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">VC8 <span style="font-size: smaller;">(Visual Studio 2005)</span></th>
      <th scope="col">VC9 <span style="font-size: smaller;">(Visual Studio 2008)</span></th>
      <th scope="col">VC10 <span style="font-size: smaller;">(Visual Studio 2010)</span></th>
      <th scope="col">VC11 <span style="font-size: smaller;">(Visual Studio 2012)</span></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">mozilla-1.9.2/comm-1.9.2<br />
        Gecko 1.9.2<br />
        Firefox 3.6</th>
      <td style="background-color: rgb(102, 255, 102);">Yes <span style="font-size: smaller;">(Official)</span></td>
      <td style="background-color: rgb(102, 255, 102);">Yes</td>
      <td style="background-color: rgb(255, 153, 153);">No</td>
      <td style="background-color: rgb(255, 153, 153);">No</td>
    </tr>
    <tr>
      <th scope="row">mozilla-central/tracemonkey/comm-central<br />
        Gecko 2 &amp; later<br />
        Firefox 4 &amp; later</th>
      <td style="background-color: rgb(102, 255, 102);">Yes<sup>1</sup> <span style="font-size: smaller;">(Official)</span></td>
      <td style="background-color: rgb(102, 255, 102);">Yes</td>
      <td style="background-color: rgb(102, 255, 102);">Yes</td>
      <td style="background-color: #FF6600;">??? <sup>2</sup></td>
    </tr>
    <tr>
      <th scope="row">Firefox 13 &amp; later</th>
      <td style="background-color: rgb(102, 255, 102);">Yes</td>
      <td style="background-color: rgb(102, 255, 102);">Yes</td>
      <td style="background-color: rgb(102, 255, 102);">Yes <span style="font-size: smaller;">(Official)</span></td>
      <td style="background-color: rgb(102, 255, 102);">Yes</td>
    </tr>
  </tbody>
</table>
<p>For building older versions of the codebase, see the <a href="/en/Windows_Build_Prerequisites_(1.9.0_and_1.9.1_branches)" title="en/Windows Build Prerequisites (1.9.0 and 1.9.1 branches)">Windows build prerequisites (1.9.0/1.9.1 branches)</a> and the <a href="/en/Windows_build_prerequisites_using_cygwin" title="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>.<br />
  <sup>1</sup>VC8 SP1 (service pack 1) is now required.</p>
<p><sup>2</sup>Note that installing both Visual Studio 2010 and Visual Studio 2012 on Windows 64-bit currently seems to break the build. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=772989" title="https://bugzilla.mozilla.org/show_bug.cgi?id=772989">Bug 772989</a> Comments 15 and 17 for a possible workaround.</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="Software_requirements">Software requirements</h2>
<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) if using certain MSVS versions</li>
  <li>MozillaBuild</li>
  <li>Microsoft DirectX&nbsp;SDK&nbsp;(optional)</li>
</ul>
<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>
<h3 id="Microsoft_Visual_C.2B.2B_(MSVC)">Microsoft Visual C++ (MSVC)</h3>
<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 want to build.</p>
<div class="warning">
  If you want to enable jemalloc, you must be using Visual Studio 2012, Visual Studio 2010 SP1, Visual Studio 2010, Visual Studio 2008 SP1 or <a class="external" href="http://www.microsoft.com/downloads/details.aspx?familyid=bb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc&amp;displaylang=en">Visual Studio 2005 SP1</a>.&nbsp; Other versions of Visual Studio will not work.</div>
<dl>
</dl>
<ul>
  <li><a href="http://www.microsoft.com/visualstudio/eng/downloads" title="http://www.microsoft.com/visualstudio/eng/downloads">Visual Studio 2012 Express for Windows Desktop</a> is available free from Microsoft.</li>
  <li>Visual C++ 10 is available from Microsoft as part of the free <a class="external" href="http://go.microsoft.com/?linkid=9709949" title="http://go.microsoft.com/?linkid=9709949">Visual C++ 2010 Express Edition</a>.</li>
  <li>Visual C++ 9 is available from Microsoft as part of the free <a class="external" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&amp;displaylang=en" title="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&amp;displaylang=en">Visual C++ 2008 Express Edition with SP1</a>&nbsp;(make sure you get this and not the one without SP1!). You do not need to install the Silverlight runtime or the SQL&nbsp;Server 2008 Express Edition when offered. Alternatively you can install the command-line compiler as part of the Windows 7 SDK, but you are then expected to use the included WinDbg debugger.</li>
  <li>The Visual C++&nbsp;8 command-line compiler is included with the Vista SDK, but you are then expected to use the included WinDbg debugger.</li>
</ul>
<h3 id="Microsoft_Windows_SDK">Microsoft Windows SDK</h3>
<p>See&nbsp;<a class="internal" href="/En/Windows_SDK_versions" title="En/Windows SDK versions">Windows SDK versions</a>.</p>
<h3 id="Microsoft_DirectX.C2.A0SDK">Microsoft DirectX&nbsp;SDK</h3>
<p>The <a href="http://www.microsoft.com/en-us/download/details.aspx?id=6812" title="http://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="http://code.google.com/p/angleproject/" title="http://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 compalibility 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 href="http://blogs.msdn.com/b/chuckw/archive/2012/03/22/where-is-the-directx-sdk.aspx" title="http://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="/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="http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=18623" title="http://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="/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="http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe" title="http://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="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&amp;displaylang=en" title="http://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="/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>
<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-msvc8.bat&nbsp; (VS 2005)</code></li>
  <li><code>start-msvc9.bat&nbsp; (VS 2008)</code></li>
  <li><code>start-msvc10.bat (VS 2010)</code></li>
  <li><code>start-msvc11.bat (VS 2012)</code></li>
</ul>
<div class="warning">
  <strong>Even if you are on 64-bit Windows, do not use the <code>start-msvcX-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="http://wiki.mozilla-x86-64.com/How_To_Build_Windows_x64_Build" title="http://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. Read on for some tips and caveats, or continue now with the build steps outlined at <a href="/En/Developer_Guide/Build_Instructions" title="https://developer.mozilla.org/en/Build_Documentation">Build Documentation</a> (probably with getting the source code).</p>
<h4 id="Command_Prompt_Tips_and_Caveats">Command Prompt Tips and Caveats</h4>
<ul>
  <li>To paste into this window, you must right-click on the window's title bar, move your cursor to the <strong>Edit </strong>menu and click <strong>Paste</strong>. You can also set Quick Edit Mode in the Properties menu and use a right-click in the window to paste your selection.</li>
  <li>If you have cygwin installed, make sure that the MozillaBuild directories come before any cygwin directories in the search path (use <code>echo $PATH</code> to see your search path).</li>
  <li>In the MSYS shell, the c: drive looks like a directory called <code>c</code> under the root directory (/). So if you want to change to the directory <code>c:\mydir</code>, in the MSYS shell you would use <code>cd /c/mydir</code>&nbsp; Note the UNIX-style forward slashes (/) in the prompt instead of the Windows-style backward slashes (\)</li>
  <li>The MSYS root directory is located in <code>c:\mozilla-build\msys</code> if you used the default installation directory. It's a good idea not to build anything under this directory. Instead use something like <code>/c/mydir</code>.</li>
</ul>
<h2 id="Common_problems.2C_hints_and_restrictions">Common problems, hints and restrictions</h2>
<ul>
  <li><a href="/en/Debugging_Mozilla_on_Windows_FAQ" title="en/Debugging_Mozilla_on_Windows_FAQ">Debugging Mozilla on Windows FAQ</a>: Tips on how to debug Mozilla on Windows.</li>
  <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>The build may fail if you have a PYTHON environment variable set. You will see an error almost immediately that says "<code>The system cannot find the file specified</code>". In a cmd-shell typing "SET PYTHON=" before running mozilla build tools in that same shell should fix this.</li>
  <li>Prior to Gecko 5.0 {{ geckoRelease("5.0") }}, your OBJDIR (build directory) cannot be within the MSYS&nbsp;root directory. If you try this, you will see linker failures (for example, if you are building into <code>/mydir/some/path</code>, it will complain about being unable to find <code>mydir:\some\path</code>).</li>
  <li>The build may fail if you have cygwin installed. Make sure that the MozillaBuild directories (<code>c:\mozilla-build</code> and subdirectories) come before any cygwin directories in your PATH environment variable. If this does not help, remove the cygwin directories from PATH, or try building on a clean PC with no cygwin.</li>
  <li>Building with versions of NSIS&nbsp;other than the version that comes with the latest supported version of MozillaBuild is not supported and will likely fail.</li>
  <li>If you're building on VS2005 and the build fails with the error message "C2118: negative subscript" on win_util.cc, you need to install the VS2005 Service Pack 1. Furthermore, if you get "LNK1103: debugging information corrupt", try installing this hotfix: <a class="external" href="http://support.microsoft.com/kb/949009" rel="freelink">http://support.microsoft.com/kb/949009</a></li>
  <li>If you intend to distribute your build to others, you will need to set <code>WIN32_REDIST_DIR=$VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT</code> in your mozconfig to get the Microsoft CRT DLLs packaged along with the application.
    <ul>
      <li>Prior to Gecko 9 (FF 9, SM 2.6, TB 9) , this was needed only if you had not built with --enable-jemalloc.</li>
    </ul>
  </li>
  <li>The <a class="external" href="http://www.microsoft.com/security/malwareremove/default.aspx" title="http://www.microsoft.com/security/malwareremove/default.aspx">Microsoft Antimalware service</a> can interfere with compilation, often manifesting as an error related to <code>conftest.exe</code> during build. &nbsp;To remedy this, add at least your object directory to the <a class="external" href="http://social.answers.microsoft.com/Forums/en-US/msescan/thread/0867c974-cf19-460d-a75d-e35f283d4ad3" title="http://social.answers.microsoft.com/Forums/en-US/msescan/thread/0867c974-cf19-460d-a75d-e35f283d4ad3">exclusion settings</a>.</li>
  <li>If you encounter an error that atlbase.h cannot be found and you have installed Visual Studio 10 Express together with the platform SDK, you may have to delete a registry entry so that guess-msvc.bat doesn't detect VC10 installed. The key is HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC.</li>
  <li>If you encounter an error like "second C linkage of overloaded function '_interlockedbittestandset' not allowed", it happens when intrin.h and windows.h are included together. Use a #define to redefine one instance of the function's name. See more on <a href="/En/Developer_Guide/Build_Instructions/Intrin.h" title="https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Intrin.h">using intrin.h</a>.</li>
</ul>
<p>{{ Warning("If you follow the below advice, your computer will <strong>not </strong>be protected against attacks that exploit this vulnerability. <strong>Make sure you take adequate precautions.</strong>") }}</p>
<ul>
  <li>If you still get random crashes when running MAKE, you may be encountering interference from Windows Security Updates that prevent proper operation of the Bash shell on some Windows systems.&nbsp; In this case, if you're on Windows XP, you will need to uninstall Windows XP Security Updates KB933729 and KB970238 using Add or Remove Programs from the Control Panel.&nbsp; The first of these Security Updates is also incorporated into Windows XP Service Pack 3 (KB936929), so if you have already installed SP3 you'll need to uninstall it and then make sure that Service Pack 2, including all Windows updates (EXCEPT KB933729, KB936929 and KB970238) get installed.&nbsp; To prevent these updates from being installed automatically, select "Notify me but don't automatically download or install them" in the Control Panel's "Automatic Updates" dialog.&nbsp; Then de-select them when any of these items appear in the list of recommended updates, and when asked, indicate that you don't want to be asked about these de-selected updates in the future.</li>
  <li>Parallel builds (-jN) do not work with GNU make on Windows. You need to use <a href="/en/pymake" title="pymake">pymake</a> instead.</li>
</ul>
<p><em><a href="/En/Developer_Guide/Build_Instructions" title="en/Build_Documentation">Return to the Build Documentation </a></em></p>
<p>{{ languages( { "de": "de/Entwicklerhandbuch/Build_Anweisungen/Windows_Build_Voraussetzungen", "es": "es/Requerimientos_para_la_compilación_en_Windows", "fr": "fr/Préalables_à_la_compilation_sous_Windows", "ja": "ja/Windows_Build_Prerequisites", "zh-cn": "cn/Windows_Build_Prerequisites" } ) }}</p>
Revert to this revision