Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

This article needs an editorial review. How you can help.

This page covers the steps needed to build a bleeding-edge, development version of Firefox for Desktop or Firefox for Android using pre-built binary artifacts.  Welcome, we're delighted to see you! :)

If you're having trouble following this documentation or hit a roadblock you can't get around, please contact Nick Alexander at [email protected] directly so we can solve the problem for you and every new contributor after you.

For additional information, see the general Firefox build documentation.

Artifact builds

Firefox for Desktop and Android supports a fast build mode called artifact mode.  The resulting builds are called artifact builds.  (Some mobile team managers call it manager mode since it's particularly helpful if you only write code infrequently.)  Artifact mode downloads pre-built C++ components rather than building them locally, trading bandwidth for time.

Artifact builds will be useful to many developers who are not working with compiled code (see "Restrictions" below). Artifacts are typically fetched from fx-team, mozilla-inbound, or mozilla-central.

To automatically download and use pre-built binary artifacts, add the following lines into your mozconfig file:

# Automatically download and use compiled C++ components:
ac_add_options --enable-artifact-builds

# Write build artifacts to:
mk_add_options MOZ_OBJDIR=./objdir-frontend

To automatically download and use the debug version of the pre-built binary artifact (currently supported for Linux, OSX and Windows artifacts), set MOZ_DEBUG="1" in your environment or add export MOZ_DEBUG="1" to your mozconfig file (with artifact builds option already enabled):

# Enable debug version of the pre-build binary artifact
export MOZ_DEBUG="1"

# Automatically download and use compiled C++ components:
ac_add_options --enable-artifact-builds

# Write build artifacts to:
mk_add_options MOZ_OBJDIR=./objdir-frontend-debug-artifact

 

Prerequisites

Artifact builds are supported for users of Mercurial and Git. Git artifact builds require a mozilla-central clone made with the help of git-cinnabar. Please follow the instructions on the git-cinnabar project page to install git-cinnabar. Further information about using git-cinnabar to interact with Mozilla repositories can be found on the project wiki. Git worktrees are not supported with artifact builds, but an easy workaround is to use git-new-workdir for a similar feature.

Building

If you've added --enable-artifact-builds to your mozconfig, each time you run mach build and mach build path/to/subdirectory the build system will determine what the best pre-built binary artifacts available are, download them, and put them in place for you.  The computations are cached, so the additional calculations should be very fast after the up-to-date artifacts are downloaded -- just a second or two on modern hardware.  Most Desktop developers should find that

./mach build
./mach run

just works.  Most Firefox for Android developers should find that

./mach build
./mach package
./mach install

just works.

Pulling artifacts from a try build

To only accept artifacts from a specific revision (such as a try build), set MOZ_ARTIFACT_REVISION in your environment to the value of the revision that is at the head of the desired push. Note that this will override the default behavior of finding a recent candidate build with the required artifacts, and will cause builds to fail if the specified revision does not contain the required artifacts.

Restrictions

Oh, so many.  Artifact builds are rather delicate: any mismatch between your local source directory and the downloaded binary artifacts can result in difficult to diagnose incompatibilities, including unexplained crashes and catastrophic XPCOM initialization and registration failures.  These are rare, but do happen.

Things that are supported

  • Modifying JavaScript, (X)HTML, and CSS resources; and string properties and DTD files.
  • Modifying Android Java code, resources, and strings.
  • Running mochitests and xpcshell tests.

Essentially everything updated by mach build faster should work with artifact builds.

Things that are not supported

  • Products other than Firefox for Desktop and Firefox for Android are not supported and are unlikely to ever be supported.
  • You cannot modify C or C++ source code anywhere in the tree.  If it's compiled to machine code, it can't be changed.
  • You cannot modify histograms.json to add Telemetry definitions.  (But see bug 1206117.)
  • Modifying build system configuration and definitions does not work in all situations.

Things that are not yet supported

  • Tests other than mochitests or xpcshell tests. There aren't inherent barriers here, but these are not known to work.
  • Modifying WebIDL definitions, even ones implemented in JavaScript.  We don't really know if there are barriers to making this work, and would appreciate somebody trying it and documenting the results.

Troubleshooting

There are two parts to artifact mode: the --disable-compile-environment option, and the mach artifact command that implements the downloading and caching.  Start by running

./mach artifact install --verbose

to see what the build system is trying to do.  There is some support for querying and printing the cache; run mach artifact to see information about those commands.

Downloaded artifacts are stored in $MOZBUILD_STATE_PATH/package-frontend, which is almost always ~/.mozbuild/package-frontend.

Discussion is best started on the dev-builds mailing list.  Questions are best raised in #build on IRC.  Please file bugs in Core :: Build Config, blocking bug 901840.

Document Tags and Contributors

 Contributors to this page: lgreco, gregtatum, kumar303, chmanchester, rolfedh, teoli, gps, nalexander
 Last updated by: lgreco,