Windows Build Prerequisites (1.9.0 and 1.9.1 branches)

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

This document is for historical use only

This document is a guide to the build prerequisites for building the Mozilla 1.9.0 (Firefox 3.0) and 1.9.1 (Firefox 3.5) codebases. For building Mozilla 1.9.2 (Firefox 3.6) or greater, please see Windows Build Prerequisites.

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, 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:

  • Builds from Mercurial code repositories
    • mozilla-1.9.1 (1.9.1/Firefox 3.5)
    • comm-1.9.1 (Thunderbird 3.0/SeaMonkey 2.0)
  • Builds from CVS code repository
    • HEAD (1.9.0.x/Firefox 3.0.x)

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

  VC7.1 (Visual Studio 2003) VC8 (Visual Studio 2005) VC9 (Visual Studio 2008) VC10 (Visual Studio 2010)
CVS HEAD
Gecko 1.9.0
Firefox 3.0
Yes Yes (Official) Yes (Experimental) No
mozilla-1.9.1/comm-1.9.1
Gecko 1.9.1
Firefox 3.51
No1 Yes (Official) Yes No

1VC7.1 cannot correctly compile the SSE2 code in libpixman. If you really want to build with VC7.1, turn on optimisations or disable SSE2 in the Makefile.

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 (Windows XP or above recommended, so that you can install the Windows Vista SDK)

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.

If you wish to enable jemalloc, you must be using Visual Studio 2005 SP1 (service pack 1) or Visual Studio 2008 SP1.  Other versions of Visual Studio will not work.
  • Visual C++ 9 is available free 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.
Note: Trying to do parallel builds using Visual C++ 7.1 (from Visual Studio 2003) using make -jN will not work.

Microsoft Windows SDK

All versions of Visual Studio require installing the Microsoft Windows Vista SDK:

  • 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 and .NET Framework 2.0 installed before installing the Vista SDK.

If you are using Visual C++ 7.1, the free Visual C++ 8 (Visual C++ 2005 Express), or the free Visual C++ 9 (Visual C++ 2008 Express), then you will also need to install the Microsoft Windows Server 2003 R2 Platform SDK in order to include some libraries (see 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.

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:

  • use another SDK (the one shipped with Visual Studio 9)
  • delete the vcvars32.bat file and repair your Visual Studio installation with the setup program
  • edit vcvars32.bat to correct the problem (see http://blogs.msdn.com/windowssdk/arc...vironment.aspx "Workaround: Repair the VS2008 command line build environment by editing c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat manually").

MozillaBuild

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

Download the latest MozillaBuild package as of the date of archival.

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.

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.

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-msvc71.bat (VS 2003)
  • start-msvc8.bat  (VS 2005)
  • start-msvc9.bat  (VS 2008)

Even if you're 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

The batch file will automatically display an MSYS command prompt window with all the appropriate environment variables set, provided the software requirements are met. On Windows, the msys window does not look like the default msys window, but rather like the default Windows command shell. All further commands should be executed in this environment.  To paste into this window, you must right-click on the window's title bar.

If you have cygwin installed, make sure that the MozillaBuild directories come before any cygwin directories in the search path (echo $PATH).

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.
  • Your OBJDIR cannot be within the MSYS root directory. Currently, the symptom will be linker failures (eg 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, and you have not built with --enable-jemalloc, 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.

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.

Return to the Build Documentation

Document Tags and Contributors

Contributors to this page: Sid0, fscholz
最終更新者: fscholz,