Development/BuildingOnline

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):

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

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

save & exit.

Prerequisites for building on Ubuntu 18.04

 * 1)   (this is not checked in configure, but fails later in make)
 * 2) cannot   since libpoco-dev and npm packages conflict (https://stackoverflow.com/questions/56463987/installing-libpoco-and-npm-conflict) so from https://github.com/nvm-sh/nvm:
 * 3) reopen terminal
 * 4) reopen terminal
 * 1) reopen terminal
 * 2) reopen terminal
 * 1) reopen terminal
 * 1) reopen terminal

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

Compilation of a LOOL docker image
A docker image is the easiest way to have a working version of LOOL built. A script (l10n-docker-nightly.sh) 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.

The script will run through the compilation of the core and the online and then build the docker image as  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   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.
 * go to https://git.libreoffice.org/online/+refs and look for the branches whose names starts with "libreoffice-", which are the non-branded mainline.
 * go to https://git.libreoffice.org/core/+refs and look for the branches whose names starts with the online version you found.

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

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:

The optional parameters  and   help to identify the container. While the first sample (6-4-4), lacking the parameters, is referred to as, the second sample is referred to as.

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.

Warning: since online branch is now from Collabora Online, you need to checkout last LibreOffice upstream version

l10n-docker-nightly.sh supported flags
The l10n-docker-nightly.sh 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.

Running separate unit tests
To run a single unit test, use this command:

To debug it, modify to this: