Development/BuildingOnWSLWindows
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. You can use WSL to build LibreOffice for Linux and run it on Windows, or you may use WSL as a helper to configure LibreOffice build, and then use GNU make to build it for Windows using Visual Studio. Here we discuss building for Windows. To build for Linux, please refer to Development/BuildingOnWSL.
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.
Windows Subsystem for Linux Documentation
There are multiple Linux distributions available in Microsoft store, and you can choose your desired distribution. The following instructions use Ubuntu, but the build is very similar across different distributions.
Build dependencies
Ubuntu dependencies
You need a few packages from WSL for the configuration. On Ubuntu, you can invoke:
sudo apt-get update sudo apt-get install build-essential zip nasm graphviz python3 python3-dev autoconf libcups2-dev libfontconfig1-dev gperf doxygen libxslt1-dev xsltproc libxml2-utils bison flex
Git for Windows
After installing WSL, install git
for Windows. You can download the latest version of the git
for Windows from download section of the git website
The build instructions should be invoked from the git bash shell.
You have to make sure that line endings are set correctly, otherwise you may get various errors. You can use this command to set them correctly:
git config core.autocrlf false
Also, make sure that you don't have the wslsys
program in your path.
GNU Make for Windows
You have to download GNU Make for Windows, and copy it to somewhere in the path.
wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
cp make-4.2.1-msvc.exe /usr/bin/make
You should be able to see the version of the GNU Make with make --version
.
Ant and JUnit
You can extract them anywhere, they don't have to be installed. If you don't want to use Junit, it can be disabled with --without-junit in the autogen.sh command later.
mkdir -p c:/sources
cd c:/sources
wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.5-bin.tar.bz2
tar -xjvf apache-ant-1.9.5-bin.tar.bz2
wget http://downloads.sourceforge.net/project/junit/junit/4.10/junit-4.10.jar
Also works with the combination of junit 4.13, hamcrest 2.2 and Apache Ant 1.10.12
Strawberry Perl
You can download and install Strawberry Perl from strawberryperl website.
Windows build dependencies
You have to install the dependencies for Windows build, and specifically Visual Studio compiler. For more information, please refer to the Windows build instructions. Other dependencies like Cygwin are not needed, as WSL provides an alternative to them.
Cloning and building
Start git bash, and try the next steps inside it. 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, which assumes JDK is in c:/jdk
, Strawberry Perl is in c:/strawberry
and JUnit and ant are in c:/sources
.
--enable-dbgutil
--with-visual-studio=2022
--disable-ccache
--with-jdk-home=C:/jdk
--without-doxygen
--enable-python=fully-internal
--with-junit=c:/sources/junit-4.10.jar
--with-ant-home=c:/sources/apache-ant-1.9.5
--with-strawberry-perl-portable=c:/strawberry
--host=x86_64-pc-cygwin
After that, you should configure the build with:
$ wsl ./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
First, you have to make sure that the configuration phase completes correctly. Sometimes when some libraries or other requirements are missing, this phase does not complete correctly. Then, you have to fix the issue, and try again with ./autogen.sh
. After the configuration phase completes correctly, you can run make
and if everything is set correctly, you should see it finishing without error.