Simple Thunderbird build


本文会带领您一步一步地编译出最新版本的Thunderbird。当然,如果您知道更多的信息,请参看build documentation



  • 推荐配置:4GB内存(最好是物理内存,如果只有2GB内存和2GB的swap空间可能无法成功编译)
  • 高带宽互联网接入


由于不同的操作系统有很大的区别,我们推荐您首先阅读您所使用的操作系统的手册,再来继续阅读本文进行编译。请注意:如果你使用的是 Linux或者MacOS,您可能需要忽略bootstrap脚本中的有关需要克隆mozilla-central目录的提示,而继续根据本文的步骤即可。

Windows 系统编译要求:[英语]

Linux 和 MacOS 系统编译要求:[英语]


注意:在Windows系统下,编译所涉及的目录路径中如若含有空格,那将会导致编译失败(例如 Documents and Settings目录等等)。您可以选择任意不含空格的路径,比如C:\thunderbird-src。
注意:如果路径名称过长(目录层次太深),也会造成部分编译失败。在 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 filesystem 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 

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

cd comm-central

then run:

python checkout
On some types of network connections, "hg clone" might fail because it gets interrupted. It is faster and more efficient to use Mercurial bundles instead the first time you fetch the complete repo. In this case, you need a bundle for comm-central, and a bundle for mozilla-central. Unbundle mozilla-central into a "mozilla" subdirectory of your comm-central repo after unbundling comm-central. Then run python checkout to ensure you are up-to-date.

The source code requires 3.2GB of free space or more and additionally 5GB or more for default build.

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

Build configuration

To build thunderbird, you need to add a file named .mozconfig to the comm-central checkout that contains the following line:

ac_add_options --enable-application=mail

If you omit this line, the build system will build Firefox instead. Other build configuration options can be added to this file, although it's strongly recommended that you only use options that you fully understand. 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. Note that if you use an MOZ_OBJDIR it cannot be a sibling folder to your source directory. Use an absolute path to be sure!

OS X 10.9/10.10 Notice

Because of an issue with the 10.9 OS X SDK, you must use an earlier SDK version. To do this add the following to your .mozconfig:

ac_add_options --with-macos-sdk=path/to/older/sdk

The path to the SDKs are usually located at /Applications/

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.

The executable will be at the location listed under Running below.

Building Thunderbird and Lightning

If you've set up your 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 favorite editor.

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


Various temporary files, libraries, and the Thunderbird executable will be found in your object directory (under comm-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 Thunderbird executable in particular, and its dependencies, are located under the dist/bin folder under the object directory. To run the executable from your comm-central working directory:

  • Windows: obj-.../dist/bin/thunderbird.exe
  • Linux: obj-.../dist/bin/thunderbird
  • OS X: obj-.../dist/

How to update and build again

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

python 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 comm-central on Treeherder 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 - don't forget to include details of what is in your mozconfig, and what the actual error is.
  • Did you make mozilla/ a symlink? That doesn't work.
  • Do you have @TOPSRCDIR@ or relative paths in your mozconfig? Those have caused several problems historically and tend to be poorly tested when the build system changes.



 此页面的贡献者: wkliang, teoli, netbeen
 最后编辑者: wkliang,