Development/BuildingOnWSL
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Introduction
Windows Subsystem for Linux (WSL) is a mechanism to run Linux applications unchanged in Windows. The initial version of this functionality is called WSL 1
, and a newer, usually faster version which uses virtualization is called WSL 2
.
The first step to build LibreOffice using WSL
is to install WSL
itself. You can follow instructions on Microsoft Website to install WSL
, preferably WSL 2
.
There are multiple Linux distributions available in Microsoft store, and you can choose your desired distribution. Here we discuss Ubuntu, and you may refer to Development/BuildingOnLinux to see instructions for other distributions. Essentially, the build is very similar to what is done on Linux.
Build dependencies
On Debian and Ubuntu, you can install the dependencies with:
sudo apt-get install git build-essential zip ccache junit4 libkrb5-dev nasm graphviz python3 python3-dev qtbase5-dev libkf5coreaddons-dev libkf5i18n-dev libkf5config-dev libkf5windowsystem-dev libkf5kio-dev libqt5x11extras5-dev autoconf libcups2-dev libfontconfig1-dev gperf openjdk-17-jdk doxygen libxslt1-dev xsltproc libxml2-utils libxrandr-dev libx11-dev bison flex libgtk-3-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev ant ant-optional libnss3-dev libavahi-client-dev libxt-dev
Cloning and building
You can clone the LibreOffice core repository with:
$ git clone https://gerrit.libreoffice.org/core libreoffice
$ cd libreoffice
You need a suitable configuration for the build that you can put inside autogen.input
file. This is a suggested configuration:
--enable-dbgutil
--without-doxygen
After that, you should configure the build with:
$ ./autogen.sh
The next step is to invoke the make
command. You can simply invoke:
$ make
And to also run the tests:
$ make check
Running your build
When build is finished, you can start LibreOffice with:
$ instdir/program/soffice
If you want to run specific application like Writer or Calc, you can invoke:
$ instdir/program/soffice --writer
$ instdir/program/soffice --calc
Tips
Error During the Build
Sometimes build may fail with an error like this:
g++: fatal error: Killed signal terminated program cc1plus compilation terminated. make[1]: *** Deleting file '/build/core/wordir/CxxObject/sw/source/filter/abc.o' make[1]: *** Waiting for unfinished jobs.... {standard input}: Assembler messages: ... g++: fatal error: Killed signal terminated program cc1plus compilation terminated. ...
In this case, don't panic! just re-run make
, and the build will continue.
Using VS Code IDE
You can use Visual Studio Code (VSCode) IDE to edit and debug the code with WSL
on Windows. You have to create the VSCode IDE integration with:
$ make vscode-ide-integration
Assuming that you have VSCode installed, you should use "Connect to WSL" in the start page to connect to WSL. Then, you may open the LibreOffice Project by using "Open Folder...", and picking the core
folder.
Please note that you need to have debugging symbols enabled (for example with --enable-dbgutil
) to be able to use the debugging feature. Then, you may simply use the "RUN AND DEBUG" button to debug LibreOffice. Please note that you need the suggested "C/C++" extension to be able to use the IDE with LibreOffice C/C++ code for debugging and code completion.