Electrolysis/Build

From MozillaWiki
Jump to: navigation, search

Building Electrolysis

Electrolysis (e10s) code currently builds with full capabilities on the following platforms:

  • Windows using Visual Studio 2008 (VC9) and 2005 (VC8)
  • Linux x86 and x86-64

For Linux, we recommend using Ubuntu 9.04 or later or Fedora Core 9 or later, although you ought be able to build with older distros/gccs.

Electrolysis work is currently (May 2011) happening on mozilla-central alongside all other Firefox development. Building Firefox with electrolysis is therefore exactly like building normal Firefox: follow the build instructions, pulling your code from http://hg.mozilla.org/mozilla-central.

There is also an electrolysis branch, where some work has been done in the past and other work may be done in the future: http://hg.mozilla.org/projects/electrolysis. Follow the same instructions linked above to build the branch.

Before deciding whether to use mozilla-central or the electrolysis branch, you may want to ask around about which repo people are currently using. Try #developers or #content on irc.mozilla.org. If the date of the last commit on the electrolysis branch is not very recent, it's likely that it's not currently being used.

Note: Currently electrolysis requires libxul, so do not set --disable-libxul in your mozconfig.

Note: If you're going to be hacking the IPDL compiler, writing IPDL C++ tests, or using the IPDL unit test framework as a "protocol sandbox", you need to build with

ac_add_option --enable-ipdl-tests

Some of these unit tests can be expensive and are disabled by default.

Optimizing build time

Electrolysis requires libxul, which means any changes you make while developing require rebuilding libxul, which can be quite slow. If you're on Linux and ld takes enough memory (it needs 2 GB+) while linking libxul to cause swapping on your machine, consider adding the following to your mozconfig file (you will also need to rerun configure, which may require deleting '$SRCDIR/configure' and/or $OBJDIR/config.cache):

 export LDFLAGS="-Wl,--no-keep-memory"

You may also be able to avoid doing a full, top-level make by building only certain directories:

If you have made any changes to any protocol files (*.ipdl), then you must run

make -C [BLD_DIR]/ipc/ipdl

If you've changed the master ContentProcess.ipdl in dom/ipc, you must make there, too:

make -C [BLD_DIR]/dom/ipc

You'll need to rebuild in any directories that have other .ipdl files you've modified, too.

Finally, rebuild libxul:

make -C [BLD_DIR]/toolkit/library

The libxul build takes by far the longest of these three, so I just dump all three commands (plus a make for whatever directory I'm working in) in a script and run it each time to rebuild. Sometimes it doesn't work :(

Consider building on a faster machine if linking libxul is slowing your productivity. Some of us are allegedly on boxes where it takes only around 5 seconds...

Running Electrolysis

To actually use separate processes, for now you must either run the "test-ipc.xul" demo, or use Fennec/e10s. Here are the instructions for running the test-ipc.xul demo:

cd $objdir/dist/bin
./firefox -P JunkProfile -chrome chrome://global/content/test-ipc.xul

Note: in this example we use a separate firefox profile specifically for running electrolysis (i.e. pass "-P JunkProfile").

Also note that normally you would need to set the dom.ipc.tabs.enabled pref to "true" in about:config before using e10s, but the test-ipc.xul file sets it for you.

Running regular firefox is not yet supported using dom.ipc.tabs.enabled. Only test-ipc.xul works.