Simple Thunderbird build

  • Revision slug: Simple_Thunderbird_build
  • Revision title: Simple Thunderbird build
  • Revision id: 470245
  • Created:
  • Creator: errietta
  • Is current revision? No
  • Comment

Revision Content

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

Build prerequisites

Hardware Requirements:

  • Recommended: 4GB of RAM (having only 2GB RAM and 2GB swap may give memory errors during compile)
  • High speed internet

Setup:

Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions.  Please note that for the Linux/MacOS build you should ignore the bootstrap script's prompt to clone the mozilla-central repository and return to this document instead.

Windows build prerequisites [en-US]

Linux and MacOS build preparation [en-US]

Get the source

Note: On Windows, you won't be able to build the Thunderbird 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:\thunderbird-src
Note: Parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).  On linux, this can manifest as problems setting up the virtualenv for running tests (failure to install pip or virtualenv because of OS access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist).  Having the source deep in a file-system hierarchy can also cause problems with pymake builds on Windows.  If you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it close to the root of your machine and re-building.

Get the latest source code from Mozilla's comm-central Mercurial code repository.

hg clone http://hg.mozilla.org/comm-central 

Then, get all the repositories it depends on. The comm-central repository includes a script to do just that. This may take a while, it's a lot of code! First, cd into the comm-central subdirectory (created automatically by the previous command), then run:

python client.py checkout
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.

The source code requires 1.5GB of free space or more.

For more on getting the source code, see the page Getting comm-central Source Code Using Mercurial [en-US].

Build configuration (optional)

By default, the build system creates a release build of Thunderbird 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 Thunderbird

To start the build, cd into the comm-central subdirectory (created automatically by the hg clone command), and run:

./mozilla/mach build

mach is our command-line tool to streamline common developer tasks. See the mach article for more.

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.

Building Thunderbird and Lightning

If you've set up you build environment as above, then all you need to do is:

echo 'ac_add_options --enable-calendar' >> .mozconfig

in the comm-central directory, or just add the ac_add_options --enable-calendar line to your .mozconfig with your favourite editor.

Then just re-run the mach command above (you can do the addition before running make for the first time)

Running

Various temporary files, libraries, and the Thunderbird 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/.

The Firefox executable in particular, and its dependencies, are located under the mozilla/dist/bin folder under the object directory. To run the executable from your comm-central working directory:

  • Windows: obj-.../mozilla/dist/bin/thunderbird.exe
  • Linux: obj-.../mozilla/dist/bin/thunderbird
  • OS X: obj-.../mozilla/dist/Daily.app/Contents/MacOS/thunderbird

How to update and build again

In your comm-central directory, run the same command as before:

python client.py checkout

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

Problems Building?

Have you:

  • Checked the Thunderbird tbpl for known failures at the time you pulled the code?
    • If the trunk is broken, you may wish to consider building one of the branches (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction)
  • Checked to make sure that the path in which you placed the source code has no spaces, and is not too long?
  • Have you searched the bug database for issues relating to your problem (e.g. platform specific issues)?
  • Try asking in mozilla.dev.builds - don't forget to include details of what is in your mozconfig, and what the actual error is.

References

Revision Source

<p>This page covers the basic steps needed to build a bleeding-edge, development version of Thunderbird. For additional, more detailed information, see the <a class="internal" href="../../../../En/Developer_Guide/Build_Instructions" rel="internal">build documentation</a>.</p>
<h2 id="Build_prerequisites">Build prerequisites</h2>
<h4 id="Hardware_Requirements.3A">Hardware Requirements:</h4>
<ul>
  <li>Recommended: 4GB of RAM (having only 2GB RAM and 2GB swap may give memory errors during compile)</li>
  <li>High speed internet</li>
</ul>
<h4 id="Setup.3A">Setup:</h4>
<p>Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions.&nbsp;<span style="line-height: 1.572;">&nbsp;Please note that for the Linux/MacOS build you should ignore the bootstrap script's prompt to&nbsp;</span><span style="line-height: 1.572;">clone the mozilla-central repository and return to this document instead.</span></p>
<p><a href="/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites" title="/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites">Windows build prerequisites [en-US]</a></p>
<p><a href="/en-US/docs/Simple_Firefox_build/Linux_and_MacOS_build_preparation" title="/en-US/docs/Simple_Firefox_build/Linux_and_MacOS_build_preparation">Linux and MacOS build preparation [en-US]</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 Thunderbird 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:\thunderbird-src</div>
<div class="note">
  <strong>Note:</strong> Parts of the build process also have problems when the source code is in a directory where the path is long (nested many levels deep).&nbsp; On linux, this can manifest as problems setting up the virtualenv for running tests (failure to install pip or virtualenv because of OS access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist).&nbsp; Having the source deep in a file-system hierarchy can also cause problems with pymake builds on Windows.&nbsp; If you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it close to the root of your machine and re-building.</div>
<p>Get the latest source code from Mozilla's <code>comm-central</code> Mercurial code repository.</p>
<pre>
hg clone http://hg.mozilla.org/comm-central 
</pre>
<p>Then, get all the repositories it depends on. The comm-central repository includes a script to do just that. This may take a while, it's a lot of code! First, cd into the <code>comm-</code><code>central </code>subdirectory (created automatically by the previous command), then run:</p>
<pre>
python client.py checkout
</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>
<p class="editable">The source code requires 1.5GB of free space or more.</p>
<p class="editable">For more on getting the source code, see the page <a href="/en-US/docs/Developer_Guide/Source_Code/Getting_comm-central" title="/en-US/docs/Developer_Guide/Source_Code/Getting_comm-central">Getting comm-central Source Code Using Mercurial [en-US]</a>.</p>
<h2 class="editable" id="Build_configuration_(optional)">Build configuration (optional)</h2>
<p>By default, the build system creates a release build of Thunderbird 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" rel="internal" title="en/Configuring Build Options">Configuring build options</a>.</p>
<h2 id="Building_Thunderbird">Building Thunderbird</h2>
<p>To start the build, cd into the <code>comm-central</code> subdirectory (created automatically by the <code>hg clone</code> command), and run:</p>
<pre>
./mozilla/mach build
</pre>
<p>mach is our command-line tool to streamline common developer tasks. See the <a href="/en-US/docs/Developer_Guide/mach" title="/en-US/docs/Developer_Guide/mach">mach</a> article for more.</p>
<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" rel="internal" title="https://developer.mozilla.org/en/Mozilla_Build_FAQ#Making_builds_faster">Tips for making builds faster</a></strong>.</p>
<h4 id="Building_Thunderbird_and_Lightning">Building Thunderbird and Lightning</h4>
<p>If you've set up you build environment as above, then all you need to do is:</p>
<pre>
echo 'ac_add_options --enable-calendar' &gt;&gt; .mozconfig
</pre>
<p>in the <code>comm-central </code>directory, or just add the <code>ac_add_options --enable-calendar</code> line to your .mozconfig with your favourite editor.</p>
<p>Then just re-run the <em>mach</em> command above (you can do the addition before running make for the first time)</p>
<h2 id="Running">Running</h2>
<p>Various temporary files, libraries, and the Thunderbird executable will be found in your <strong>object directory</strong> (under <code>mozilla-central/</code>), which is prefixed with <strong><code>obj-</code></strong>. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of <strong><code>obj-x86_64-apple-darwin10.7.3/</code></strong>.</p>
<p>The Firefox executable in particular, and its dependencies, are located under the <code>mozilla/dist/bin</code> folder under the object directory. To run the executable from your <code>comm-central</code> working directory:</p>
<ul>
  <li><strong>Windows:</strong> <code>obj-.../mozilla/dist/bin/thunderbird.exe</code></li>
  <li><strong>Linux:</strong> <code>obj-.../mozilla/dist/bin/thunderbird</code></li>
  <li><strong>OS X:</strong> <code>obj-.../mozilla/dist/Daily.app/Contents/MacOS/thunderbird</code></li>
</ul>
<h2 id="How_to_update_and_build_again">How to update and build again</h2>
<p>In your <code>comm-central</code> directory, run the same command as before:</p>
<pre>
python client.py checkout
</pre>
<p>Then just re-run the <em>mach</em> command above. This 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>
<h2 id="Problems_Building.3F">Problems Building?</h2>
<p>Have you:</p>
<ul>
  <li>Checked the <a class="external" href="https://tbpl.mozilla.org/?tree=Thunderbird-Trunk" title="http://tinderbox.mozilla.org/showbuilds.cgi?tree=ThunderbirdTrunk">Thunderbird tbpl</a> for known failures at the time you pulled the code?
    <ul>
      <li>If the trunk is broken, you may wish to consider building <a href="/En/Developer_Guide/Source_Code/Getting_comm-central" title="https://developer.mozilla.org/En/Developer_Guide/Source_Code/Getting_comm-central">one of the branches</a> (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction)</li>
    </ul>
  </li>
  <li>Checked to make sure that the path in which you placed the source code has no spaces, and is not too long?</li>
  <li>Have you searched the <a class="link-https" href="https://bugzilla.mozilla.org/" title="https://bugzilla.mozilla.org/">bug database</a> for issues relating to your problem (e.g. platform specific issues)?</li>
  <li>Try asking in <a class="external" href="http://groups.google.com/group/mozilla.dev.builds/" title="http://groups.google.com/group/mozilla.dev.builds/">mozilla.dev.builds</a> - don't forget to include details of what is in your mozconfig, and what the actual error is.</li>
</ul>
<h3 id="References">References</h3>
<ul>
  <li><a class="internal" href="/En/Developer_Guide/Build_Instructions" title="En/Developer Guide/Build Instructions">General Build Documentation</a></li>
  <li><a class="internal" href="/en/comm-central" title="en/comm-central">comm-central</a></li>
  <li><a href="/en/Using_the_Mozilla_symbol_server" title="en/Using the Mozilla symbol server">Using the Mozilla symbol server</a></li>
</ul>
Revert to this revision