From The Document Foundation Wiki
Jump to: navigation, search

Introductory notice

Compilation of LibreOffice online (LOOL from this point) can be quite tricky. Using docker is highly suggested and is what this wiki page covers. For a native installation you can also have a look at this document by the infrastructure team.

System requirements

The compilation will require almost 30GB. Suggested setup: at least a 2 cores-CPU with 4GB of RAM.

Environment setup

Since LibreOffice core build fails when trying to make as root, LOOL build is even encouraged to be run as regular user. This user needs access to sudo without password to set the capabilities of the newly-build executables. Therefore, using isolate machines to run the builds is suggested.

The first step is to create the user (make sure even to create the home for the user since it's required by npm): useradd -s /bin/bash -m lool

The user also needs to be a member of the Docker group to build the image: adduser lool docker

Once the user is created, you will need to authorize him to use sudo. Edit the sudoers file (with your preferred editor or running visudo) and add something like

lool ALL=(ALL) NOPASSWD: /sbin/setcap, /usr/bin/echo

save & exit.


This guide has been written and tested on Debian 10. Packages names and versions may vary on other distros. Ubuntu 18.04 instructions follows.

Prerequisites for building on Debian 10

  1. apt-get install -y git build-essential devscripts libkrb5-dev openssl g++ libssl-dev libcap-dev libtool m4 automake libcppunit-dev libcppunit-doc pkg-config python-polib python3-polib default-jre libpam-dev npm python-lxml python3-lxml translate-toolkit locales-all libpng16-16 fontconfig adduser cpio findutils nano libpoco-dev libcap2-bin openssl inotify-tools procps libubsan1
  2. apt-get build-dep -y libreoffice
  3. npm i npm@latest -g

Prerequisites for building on Ubuntu 18.04

  1. apt-get install python3-lxml libcap-dev python3-polib libpam-dev libpoco-dev procps inotify-tools build-essential devscripts libcap2-bin libkrb5-dev cpio
  2. apt-get build-dep -y libreoffice
  3. apt-get install python-polib
    (this is not checked in configure, but fails later in make)
  4. cannot apt-get install npm since libpoco-dev and npm packages conflict ( so from
    1. wget -qO- | bash
    2. reopen terminal
    3. nvm install node
    4. reopen terminal

Clone of the repository

Now choose a working directory. The following will use /opt. Use of /tmp is discouraged.

mkdir -p /opt
cd /opt
git clone --depth=1
chown -R lool. online

Compilation of a LOOL docker image

A docker image is the easiest way to have a working version of LOOL built. A script ( is provided by LOOL developers to (almost) automatically build the required core part, LOOL and close the binaries inside a docker container.

If you have followed the Environment setup you're ready to run the build.

cd /opt/online/docker
su lool

The script will run through the compilation of the core and the online and then build the docker image as libreoffice/online:master but (normally) will fail to push (since you don't have access to the libreoffice namespace in the dockerhub) but you can disable the push by using the NO_DOCKER_PUSH flag.

Choosing the branch to compile

If you're interested in compiling a stable image, make sure to pick the same version of the software from online and core.

For example, if you want to compile the latest stable version you have to

At the moment of writing this page, the latest available is libreoffice-6-4.

At the moment of writing this page, the latest core available that matches with the online is the libreoffice-6-4-4.

Now that you found out which branches you want to compile, you simply have to start the build with something like

LIBREOFFICE_BRANCH="libreoffice-6-4-4" LIBREOFFICE_ONLINE_BRANCH="libreoffice-6-4"  NO_DOCKER_PUSH="yes" ./

Of course, if stability doesn't matter for you, you can simply build the two master branches. And here's another sample for the 7.0 branch:

DOCKER_HUB_REPO=libreoffice/online DOCKER_HUB_TAG=7-0-0 LIBREOFFICE_BRANCH="libreoffice-7-0-0" LIBREOFFICE_ONLINE_BRANCH="libreoffice-7-0" NO_DOCKER_PUSH="yes" ONLINE_EXTRA_BUILD_OPTIONS="--enable-anonymization" ./

The optional parameters DOCKER_HUB_REPO and DOCKER_HUB_TAG help to identify the container. While the first sample (6-4-4), lacking the parameters, is referred to as libreoffice/online:master, the second sample is referred to as libreoffice/online:7-0-0.

Automating stable compilation

The following script may be used to automatically fetch the latest (supposed) stable version and compile it. You can run it in something like a nightly build. In any case, using ccache is highly suggested to enhance a lot the build times after the first.

cd /opt
[ -e online ] || git clone --depth=1
cd online
git pull origin master
cd docker
git ls-remote | cut -f 2 | grep -e '^refs/heads/libreoffice' | tail -1 | rev | cut -d '/' -f 1 | rev > core-branch
git ls-remote | cut -f 2 | grep -e '^refs/heads/libreoffice' | tail -1 | rev | cut -d '/' -f 1 | rev > online-branch
LIBREOFFICE_BRANCH="$(cat core-branch)" LIBREOFFICE_ONLINE_BRANCH="$(cat online-branch)" DOCKER_HUB_TAG="$(cat online-branch)-$(date +%Y-%m-%d)" NO_DOCKER_PUSH="yes" ONLINE_EXTRA_BUILD_OPTIONS="--enable-anonymization --with-max-connections=100000 --with-max-documents=100000" ./ supported flags

The script supports a few variables to personalize the build. An up-to-date list of the supported flags are written in the first comments of the script.

Flag Function Behaviour
DOCKER_HUB_REPO which Docker Hub repo to use Changes the docker image name. If undefined, libreoffice/online will be used.
DOCKER_HUB_TAG which Docker Hub tag to create Changes the docker image tag. If undefined, master will be used.
LIBREOFFICE_BRANCH which branch to build in core Changes the branch to build from the core repository. If undefined, master will be used.
LIBREOFFICE_ONLINE_BRANCH which branch to build in online Changes the branch to build from the online repository. If undefined, master will be used.
LIBREOFFICE_BUILD_TARGET which make target to run (in core repo) Changes the build target of core. If undefined, nothing will be passed to make.
ONLINE_EXTRA_BUILD_OPTIONS extra build options for online Adds options to the ./configure script of the online repository.
NO_DOCKER_IMAGE if set, don't build the docker image itself, just do all the preps if undefined, the option will be performed
NO_DOCKER_PUSH don't push to docker hub if undefined, the option will be performed

Running separate unit tests

To run a single unit test, use this command:

(cd test; CPPUNIT_TEST_NAME="TestClass::TestMethod" ./unittest)

To debug it, modify to this:

(cd test; CPPUNIT_TEST_NAME="TestClass::TestMethod" gdb --args ./unittest)