Simple Firefox build

  • Revision slug: Simple_Firefox_build
  • Revision title: Simple Firefox build
  • Revision id: 298303
  • Created:
  • Creator: KevinGadd
  • Is current revision? No
  • Comment

Revision Content

This page covers the basic steps needed to build a bleeding-edge, development version of Firefox. For additional, more detailed information, see the build documentation.

Install build prerequisites

Before you can build Firefox, you'll need the build tools listed below and a few gigabytes of free disk space. Builds will be slow unless you have at least 2GB of RAM.

Linux

Run the following commands in a shell to install the needed tools:

Ubuntu users:

sudo apt-get build-dep firefox
sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm uuid

Debian users: Same as Ubuntu, but replace the first command with sudo apt-get build-dep iceweasel

Fedora users:

sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
sudo yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-devel alsa-lib-devel libXt-devel libX11-devel

Problems? See Linux build prerequisites.

Mac

  • Install Xcode 3. You can download this from Apple, or install it from the OS DVDs that came with your Mac.
  • If you're using OS X 10.6.5 or later, install the Java for Mac OS X 10.6 Developer Package.  Otherwise install the Java for Mac OS X 10.7 Developer Package if you're using OS X 10.7. (This is for a file required by the MacPorts packages that we install next.)
  • Install MacPorts, and then run these commands in a shell:
    sudo port sync
    sudo port install mercurial libidl autoconf213 yasm
    
    
  • Alternatively you might try homebrew, which is an alternative to MacPorts.
    brew install yasm mercurial libidl
    brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb

Problems? See Mac OS X build prerequisites.

Windows

  • Make sure your system is up-to-date through Windows Update. Windows XP needs at least Service Pack 2 and .NET Framework 2.0.
  • Install Visual C++ 2005 Professional, VC++ 2008 Professional or Express with SP1 (free), Visual C++ 2010 Professional or Express (free). VC++ 2008 Express without SP1 will not work.
  • You may need to install one or more Windows SDKs. See Windows SDK versions for a quick guide.
  • Install the June 2010 DirectX SDK.
  • 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. Use the shortcuts on your desktop, or run c:\mozilla-build\start-msvcX.bat (where X is 8 for VS 2005, 9 for VS 2008 and 10 for VS 2010). Even if you're on 64-bit Windows, do not use the start-msvcX-x64.bat files (unless you know what you're doing), since they are experimental and unsupported. See the Build:MozillaBuild For x64 wiki page.

Problems? See Windows build prerequisites.

Get the source

Note: On Windows, 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:\firefox-src

Get the latest source code from Mozilla's Mercurial code repository. This may take a while; it's a lot of code!

hg clone http://hg.mozilla.org/mozilla-central
On some types of network connections, "hg clone" might fail because it gets interrupted.  If your "hg clone" command won't finish, try using a Mercurial bundle instead.

Build configuration (optional)

By default, the build system creates a release build of Firefox roughly equivalent to the official Firefox release builds. If that's not exactly what you want, there are many build configuration options to choose from, although it's strongly recommended that you only use options that you fully understand. The normal way to specify build options is to place them in a file called '.mozconfig' at the root of your mozilla source tree. For example, to create a debug build instead of a release build, that file would contain:

ac_add_options --enable-debug

For more on configuration options, see the page Configuring build options.

Building

On Windows, you are strongly advised to use PyMake instead, since Windows parallel builds are not reliable when using GNU make. In addition, PyMake recurses in a single process reducing the number of shell invocations, which are particularly expensive on Windows.

On Mac OS X, and GNU/Linux to start the build, cd into the mozilla-central subdirectory (created automatically by the hg clone command), and run:

make -f client.mk

Building can take a significant amount of time, depending on your system, OS and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. Tips for making builds faster.

Various compiled files, libraries, and the Firefox executable will be found in your object directory (under mozilla-central/), which is prefixed with obj-. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of obj-x86_64-apple-darwin10.7.3/.

From the object directory, Windows users should run dist/bin/firefox.exe, Linux users should run dist/bin/run-mozilla.sh dist/bin/firefox, and OS X users should run dist/Nightly.app/Contents/MacOS/firefox.

How to update and build again

To pull the latest changes and update the code in your mozilla-central working directory, run the command:

hg pull -u

Then just re-run the "make -f client.mk" command above. make will only recompile files that changed, but it's still a long haul. An incremental build can be faster.

{{ languages( { "ja": "ja/Simple_Firefox_build" } ) }}

Revision Source

<p>This page covers the basic steps needed to build a bleeding-edge, development version of Firefox. For additional, more detailed information, see the <a class="internal" href="/En/Developer_Guide/Build_Instructions" title="En/Build Documentation">build documentation</a>.</p>
<h2 id="Install_build_prerequisites">Install build prerequisites</h2>
<p>Before you can build Firefox, you'll need the build tools listed below and a few gigabytes of free disk space. Builds will be slow unless you have at least 2GB of RAM.</p>
<h3 id="Linux">Linux</h3>
<p>Run the following commands in a shell to install the needed tools:</p>
<p><strong>Ubuntu</strong> users:</p>
<pre>
sudo apt-get build-dep firefox
sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm uuid
</pre>
<p><strong>Debian</strong> users: Same as Ubuntu, but replace the first command with <code>sudo apt-get build-dep iceweasel</code></p>
<p><strong>Fedora</strong> users:</p>
<pre>
sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
sudo yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-devel alsa-lib-devel libXt-devel libX11-devel
</pre>
<p>Problems? See <a href="/En/Developer_Guide/Build_Instructions/Linux_Prerequisites" title="https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Linux_Prerequisites">Linux build prerequisites</a>.</p>
<h3 id="Mac">Mac</h3>
<ul>
  <li>Install <a class="link-https" href="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792" title="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792">Xcode 3</a>. You can download this from Apple, or install it from the OS&nbsp;DVDs that came with your Mac.</li>
  <li>If you're using OS X 10.6.5 or later, install the <a class="external" href="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719" title="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719">Java for Mac OS X 10.6 Developer Package</a>.&nbsp; Otherwise install the <a class="link-https" href="https://developer.apple.com/downloads/download.action?path=Developer_Tools/java_for_mac_os_x_10.7_update_1_developer_package/javadeveloper_for_mac_os_x_10.7__11m3527.dmg" title="https://developer.apple.com/downloads/download.action?path=Developer_Tools/java_for_mac_os_x_10.7_update_1_developer_package/javadeveloper_for_mac_os_x_10.7__11m3527.dmg">Java for Mac OS X 10.7 Developer Package</a> if you're using OS X 10.7. (This is for a file required by the MacPorts packages that we install next.)</li>
  <li>Install <a class="external" href="http://www.macports.org/install.php">MacPorts</a>, and then run these commands in a shell:
    <pre class="eval">
sudo port sync
sudo port install mercurial libidl autoconf213 yasm

</pre>
  </li>
  <li><span class="external">Alternatively you might try </span><a class="link-https" href="https://github.com/mxcl/homebrew" title="https://github.com/mxcl/homebrew">homebrew</a>, which is an alternative to MacPorts.<br />
    <pre>
brew install yasm mercurial libidl
brew install https://raw.github.com/Homebrew/homebrew-versions/master/autoconf213.rb</pre>
  </li>
</ul>
<p>Problems? See <a class="internal" href="/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites" title="en/Mac_OS_X_Build_Prerequisites">Mac OS X build prerequisites</a>.</p>
<h3 id="Windows">Windows</h3>
<ul>
  <li>Make sure your system is up-to-date through&nbsp;Windows Update. Windows XP needs at least <a class="external" href="http://www.microsoft.com/windowsxp/sp2/default.mspx">Service Pack 2</a> and <a class="external" href="http://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 Visual C++ 2005 Professional, VC++&nbsp;2008 Professional or <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">Express with SP1 (free)</a>, Visual C++ 2010 Professional or <a class="external" href="http://go.microsoft.com/?linkid=9709949" title="http://go.microsoft.com/?linkid=9709949">Express (free)</a>. VC++ 2008 Express without SP1 will not work.</li>
  <li>You may need to install one or more Windows SDKs. See <a class="internal" href="/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="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6812" title="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=6812">June 2010 DirectX SDK</a>.</li>
  <li>Install <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">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>
</ul>
<p>The rest of the build steps are done from the MSYS shell installed with MozillaBuild. Use the shortcuts on your desktop, or run <code>c:\mozilla-build\start-msvcX.bat</code> (where X is 8 for VS 2005, 9 for VS 2008 and 10 for VS 2010). <strong>Even if you're on 64-bit Windows, do not use the <code>start-msvcX-x64.bat</code> files </strong>(unless you know what you're doing), since they 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" rel="external nofollow" target="_blank" title="http://wiki.mozilla-x86-64.com/How_To_Build_Windows_x64_Build">Build:MozillaBuild For x64 wiki page</a>.</p>
<p>Problems? See <a class="internal" href="/En/Developer_Guide/Build_Instructions/Windows_Prerequisites" title="en/Windows_Build_Prerequisites">Windows build prerequisites</a>.</p>
<h2 id="Get_the_source">Get the source</h2>
<div class="note">
  <strong>Note:</strong> On Windows, 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:\firefox-src</div>
<p>Get the latest source code from Mozilla's Mercurial code repository. This may take a while; it's a lot of code!</p>
<pre>
hg clone http://hg.mozilla.org/mozilla-central
</pre>
<div class="warning">
  On some types of network connections, "hg clone" might fail because it gets interrupted.&nbsp; If your "hg clone" command won't finish, try using a <a href="/En/Developer_Guide/Source_Code/Mercurial#Bundles" title="https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29#Bundles">Mercurial bundle</a> instead.</div>
<h2 id="Build_configuration_(optional)">Build configuration (optional)</h2>
<p>By default, the build system creates a release build of Firefox roughly equivalent to the official Firefox release builds. If that's not exactly what you want, there are many build configuration options to choose from, although it's <strong>strongly</strong> recommended that you only use options that you fully understand. The normal way to specify build options is to place them in a file called '.mozconfig' at the root of your mozilla source tree. For example, to create a debug build instead of a release build, that file would contain:</p>
<pre>
ac_add_options --enable-debug
</pre>
<p>For more on configuration options, see the page <a href="/en/Configuring_Build_Options" title="en/Configuring Build Options">Configuring build options</a>.</p>
<h2 id="Building">Building</h2>
<div class="note">
  On Windows, you are <strong>strongly advised</strong> to use <a href="/en/pymake" title="pymake">PyMake</a> instead, since Windows parallel builds are not reliable when using GNU make. In addition, PyMake recurses in a single process reducing the number of shell invocations, which are <a class="external" href="http://benjamin.smedbergs.us/blog/2009-04-02/pymake-25-faster-than-msys-make/" title="http://benjamin.smedbergs.us/blog/2009-04-02/pymake-25-faster-than-msys-make/">particularly expensive on Windows</a>.</div>
<p>On Mac OS X, and GNU/Linux to start the build, cd into the <code>mozilla-central </code>subdirectory (created automatically by the <code>hg clone</code> command), and run:</p>
<pre>
make -f client.mk
</pre>
<p>Building can take a significant amount of time, depending on your system, OS and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. <strong><a href="/en/Developer_Guide/Mozilla_build_FAQ#Making_builds_faster" title="https://developer.mozilla.org/en/Mozilla_Build_FAQ#Making_builds_faster">Tips for making builds faster</a></strong>.</p>
<p>Various compiled files, libraries, and the Firefox executable will be found in your object directory (under <code>mozilla-central/</code>), which is prefixed with <code>obj-</code>. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of <code>obj-x86_64-apple-darwin10.7.3/</code>.</p>
<p>From the object directory, <strong>Windows</strong> users should run <code>dist/bin/firefox.exe</code>, <strong>Linux</strong> users should run <code>dist/bin/run-mozilla.sh dist/bin/firefox</code>, and <strong>OS&nbsp;X</strong>&nbsp;users should run <code>dist/Nightly.app/Contents/MacOS/firefox.</code></p>
<h2 id="How_to_update_and_build_again">How to update and build again</h2>
<p>To pull the latest changes and update the code in your <code>mozilla-central</code> working directory, run the command:</p>
<pre>
hg pull -u
</pre>
<p>Then just re-run the "<code>make -f client.mk</code>" command above. <code>make</code> will only recompile files that changed, but it's still a long haul. An <a class="internal" href="/en/Incremental_Build" title="En/Incremental Build">incremental build</a> can be faster.</p>
<p>{{ languages( { "ja": "ja/Simple_Firefox_build" } ) }}</p>
Revert to this revision