If you’re following this blog, you may be aware of the recent work on shared compilation cache. This has been deployed with great results on Mozilla’s try server for all platforms (except a few build types, like ASAN or valgrind), and is being tested for Linux/Android builds on b2g-inbound (more on that in subsequent posts).
A side effect of the work to make it run on all platforms is that it now works to build Firefox on Windows, although it requires a specific setup. And since recently, it’s also possible to use it with local storage instead of S3. This means we now have a (basic) ccache for Windows that works to build Firefox.
If you wish to try it, here is what you need to do:
- Clone the repository from github:
$ git clone https://github.com/glandium/sccache
- Add the following to your
ac_add_options "--with-compiler-wrapper=python2.7 path/to/sccache/sccache.py" export _DEPEND_CFLAGS='-deps$(MDDEPDIR)/$(@F).pp' mk_add_options "export CC_WRAPPER=" mk_add_options "export CXX_WRAPPER=" mk_add_options "export COMPILE_PDB_FLAG=" mk_add_options "export HOST_PDB_FLAG=" mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"
path/to/sccache/sccache.pyneeds to be a windows-like path (as opposed to msys/cygwin path) with forward slashes.
- Then set the
SCCACHE_DIRenvironment variable to some local directory.
- And build happily.
A few things to note:
- As of writing, sccache doesn’t support cleaning up the storage directory, so it will grow indefinitely (until you clean it up yourself).
- Because the MSVC preprocessor is not exactly fast, and because sccache doesn’t have a direct mode like ccache, it doesn’t make as much difference as ccache does.
- It also works on non-windows, but doesn’t require all the
mozconfigchanges, except for the
Play with it and feel free to fork it on github, and improve it. Pull requests encouraged.