Skip to content

Speeding up compilation times for Libreoffice / C++ projects

Srijan Choudhary
1 min read

I got interested in LibreOffice a few days ago, and wanted to contribute. I wanted to see how a large project is run, and the Easy Hacks section looked easy enough to begin.

But, there was one problem: LibreOffice is huge, and takes a long time to compile (especially for the first time). It took ~40 minutes to build on the best workstation I have access to (a 24 core intel server). It would take more than a day to build on my laptop, and I wanted to be able to build and iterate on my laptop.

The How to Build wiki had a few pointers, and I decided to look into them.


As noted on their website, ccache is a compiler cache, and speeds up compilation by storing stuff, and reusing them on recompilation. This won't decrease the first compile time (in fact, it might increase it), but future compilations would be faster.

To use ccache, I made an exports file (see below) which I source before doing any LibreOffice related stuff. Programs like ondir can help automate this. I decided on a max cache size of 8GB, and set it with:

$ ccache --max-size 8G


Icecream enables distributing the compiling load to multiple machines, like distcc. I decided to go with icecream because support for it is built into LibreOffice's

Using icecream turned out to be as simple as installing and starting services on the build machines, doing ./ --enable-icecream, followed by make. For projects that don't have such icecream flags, its enough to add icecream's bin directory to the beginning of $PATH, and everything works.

Icecream can do a distributed build even if the machines in the cluster are of different types. This section of their readme gives more information about that.

Building LibreOffice on my laptop using icecream took about 50 minutes (for a clean build).

My file

export CCACHE_DIR=/mnt/archextra/libreoffice/ccache
export ICECC_VERSION=/mnt/archextra/libreoffice/i386.tar.gz

Related Posts

Members Public

Slackbot using google cloud serverless functions

Slack bot using Google Cloud Functions to post a roundup of recently created channels

Slackbot using google cloud serverless functions
Members Public

Erlang: Dialyzer HTML Reports using rebar3

How I made a custom rebar3 plugin to generate HTML reports for dialyzer warnings

Members Public

Running multiple emacs daemons

Run multiple emacs daemons for different purposes and set different themes/config based on daemon name