General questions

Which systems are supported Mozilla build platforms?
See Supported build configurations.

Locating errors

Build failed without any error message, how can I find the problem?
In your obj directory, go to the directory in which build failed and type make (or gmake if necessary). This will relaunch the build for this specific piece of code, displaying more detailed error messages.

Getting Help

I'm running into a problem and I don't see a solution for it. Where can I get help?
We have an IRC channel dedicated to helping people getting started with the Mozilla codebase called #introduction on the IRC.mozilla.org server. You can learn more about connecting with Mozillians on IRC here. You can also send your question directly to Mike Hoye - mhoye@mozilla.com - and he will steer it to the right people.

Windows-specific questions

Note: See Windows Build Prerequisites for additional information. While you can still build FIrefox _for_ 32-bit Windows systems, building on 32-bit Windows machines is not supported.
configure: error: installation or configuration problem: C compiler cannot create executables.
Look at the config.log in the obj... directory. Try checking to make sure your PATH variable includes all the necessary directories. If you are using mozilla-build, then you need to start ming32 with one of the start-msvc*.bat files. If your build environment has changed, you may need to delete your config.cache file (in your mozilla or object directory) and then build again.
client.mk:121 *** This source tree appears to have Windows-style line endings.
This occurs when you are using git and do not have the proper line ending settings. The commands to set the proper line endings are (note this will remove local changes):
git config core.autocrlf false
git config core.eof lf
git rm --cached -r .
git reset --hard

Mingw32-specific questions

Unix-specific questions

How do I build on Solaris 10 x86?
See Solaris Build Prerequisites.

Mac-specific questions

It doesn't work
For common Mac build errors and additional troubleshooting tips, see Troubleshooting in Mac OS X Build Prerequisites.  In particular, bootstrap.py can diagnose and suggest fixes for most common errors (wrong Xcode version, missing build dependencies).
curl https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py > bootstrap.py && python bootstrap.py
Can I build a Mozilla application as a Universal Binary?
Yes. See Mac OS X Universal Binaries for instructions.

Making builds faster

How can I build only the parts I've changed?

See also Incremental Build.

Do parallel (make -j) builds work for Mozilla?

Yes. See the GNU Make Parallel Execution manual entry for optimal usage.

As of December 2012, running builds through mach or client.mk will result in the optimal values being passed to make automatically. If you would like to change the default values, add something like the following to your mozconfig file:

mk_add_options MOZ_MAKE_FLAGS=-j8

Set the integer value after -j to the max number of parallel processes to use. For optimal builds, this should be around the number of processor cores in your system.

(note: I have found that relying on automatic setting may not yield optimum results, in my case manually setting make -j resulted in a 50% decrease in build time. -j1 may keep it from blocking / becoming unresponsive.)

I have less than 4GB RAM, is there any way I can speed up linking?

Yes, disabling debugging symbols can speed up linking considerably. Add the following to your .mozconfig:

ac_add_options --disable-debug-symbols
How can I turn on distcc to help compilation?

In your .mozconfig file, add:

mk_add_options MOZ_MAKE_FLAGS="CC='distcc gcc' CXX='distcc g++' -jN"

See the notes for parallel builds.

Can I use ccache to speed up builds?

Yes. See the ccache page for more details. Use of ccache is highly encouraged to speed up builds.

Where else can I save cycles?
Redirecting stdout, rather than dumping it into a terminal, can save between 30 seconds and 5 minutes on a build. Displaying lots of text is slow!

Build configurations

Can I build multiple Mozilla-based projects from a single source tree?
Yes! Each project must be built in its own objdir.
What is a .mozconfig file?
It tells which Mozilla application to build and contains configuration options. See Using a .mozconfig configuration file.
What is an objdir?

An objdir build refers to the process of creating the output files in a different place than where the source lives. This is a standard feature of most configure-based projects. It allows you to build for multiple configurations, including multiple platforms if you use a network filesystem, from a single source tree. It also avoids tainting your source tree so that you know that the files in your tree have not been modified by the build process.

If you run configure by hand, you can use the standard method of creating an empty directory any place on the disk, changing to that directory and running /path/to/mozilla/configure from there.

mkdir obj-debug
cd obj-debug
../mozilla/configure

If you use client.mk to build, you can add the following to your mozconfig file:

mk_add_options MOZ_OBJDIR=/path/to/objdir
Can I cross-compile Mozilla?
Yes, see the Cross-Compiling Mozilla document for details.
How do I force the build system to pick up any of the changes made to my mozconfig file?
Touch any of the configure scripts in the tree. There is no explicit dependency upon the mozconfig file as the file can reside anywhere via the MOZCONFIG environment variable.

Implementation questions

What type of build system does Mozilla use?
Mozilla uses a thin GNU configure layer on top of a recursive makefile build system on all platforms. Like most configure-based projects, it uses GNU autoconf to generate the configure script. GNU make is used to drive the build process.
Why use GNU make?
GNU make has been ported to a lot of systems. This makes porting Mozilla to those systems a bit easier. Using only the subset of make features that are supported by the native make program on 10 different platforms would make the build system unnecessarily complicated.
Will any other version of make work?
No. The Mozilla makefiles use GNU make specific features which will only work with gnu make.
Why aren't you using automake?
Part of Netscape's legacy system involved using GNU make's -include feature to include a common set of rules from a handful of files in every Makefile that needed to use them. With this centralized rule system, one of the primary selling points of automake was made inconsequential. Also, at the time, Mozilla's method of building libraries did not mesh well with libtool.
What happened to the nmake and CodeWarrior build systems?
They no longer exist in the current tree. nmake build support was dropped during the Mozilla 1.2a release cycle. The Mac CFM build system was dropped along with OS 9 support shortly after the Mozilla 1.3 release.
Why not ant, tmake, scons or insert your favorite build system here?
Mainly, because no one has implemented these systems for Mozilla. When Mozilla was first open sourced, it only contained the legacy Netscape system. The autoconf layer was added on a branch and maintained in parallel for 6 months before it became the standard build system for the unix build. Several experimental ports to various systems have failed because of the size of the project. Because building Mozilla involves much more than just compiling, any port requires system investment in creating custom rules.
If I wanted to implement my favorite build system for Mozilla, would Mozilla start using it? I don't want to waste my time if you aren't going to use it.
There's no guarantee that any code written for Mozilla will be accepted into the default tree. Any build system that is implemented would have to show that it's better overall than the current build system. Speed, flexibility, portability and the ability for a large group of developers who have 3+ years experience with the current build system to easily transition to the new system would be the major factors in deciding to switch.
Why doesn't Mozilla support autoconf 2.5x?

In other words, autoconf 2.5x does not offer anything to make the upgrade worth the effort. Autoconf 2.5x is not backwards compatible with autoconf 2.13 and the additional restrictions made by the newer versions of autoconf would require a major rewrite of the Mozilla build system for questionable gain.

Some of the 2.13 features, such as the ability to pass additional arguments to sub-configures, are not available in 2.5x. People have asked repeated about those features on the autoconf mailing list without any favorable response. Rewriting the configures of the sub-projects of Mozilla (NSPR & LDAP) is not an acceptable tradeoff. The sub-projects are also standalone projects and forking an entire codebase because of a build system incompatibility is silly.

Why doesn't NSS use autoconf?
The NSS project is also used outside of the Mozilla project and the NSS project members did not feel that moving to autoconf was worth the cost. See bug 52990 for details.

See also