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.
These instructions assume you have not installed any WSL container. The automated steps install an Ubuntu WSL container and the required packages only, if existing containers are not found.
Windows Subsystem for Linux Documentation
Dev Drive
Windows 11 offers the possibility to create storage volumes called Dev Drives, which improve performance when doing development. Using a Dev Drive has the additional benefit of avoiding errors caused by anti-virus tools. If you don't use a Dev Drive, make sure your anti-virus software will not cause any problems. The instructions below assume LibreOffice source code goes into your user directory, so if you decide to use a Dev Drive, adapt accordingly.
Cloning the source code and installing build dependencies
Launch Windows Command Prompt as a normal user and run the following:
Command to install Git (run as normal user in Command Prompt) |
---|
|
Start Git Bash and run the following:
Command clone LibreOffice source code (run in Git Bash) |
---|
|
The cloning options use a more efficient protocol and prevent messing up line endings in files. If you want to set these options globally as the default, give the command git config --global protocol.version 2 ; git config --global core.autocrlf false
Launch another Command Prompt window as administrator (right-click, Run as administrator). Run the following:
Winget commands to install Visual Studio and other dependencies (run as administrator in Command Prompt) |
---|
|
Switch back to the Command Prompt window of your normal user and run the following:
Winget command to install more needed dependencies and a WSL Ubuntu distribution (run as normal user in Command Prompt) |
---|
|
This step also creates an autogen.input file in the LibreOffice source code directory with build options. Open the file in a code editor and uncomment the line that says #--enable-dbgutil
, if you want to do LibreOffice development with debugging capabilities.
Building LibreOffice
Switch to Git Bash and run the following:
Commands for installing commit hooks, doing configuration and building of LibreOffice (run inside Git Bash) |
---|
|
To also run the tests:
Command to start the build and tests (run inside Git Bash) |
---|
|
If you hit issues, first consult the known problems section of the main Windows build article.
Running your build
When the build is finished, you can start LibreOffice with:
instdir/program/soffice
If you want to run specific applications like Writer or Calc, you can invoke:
instdir/program/soffice --writer
instdir/program/soffice --calc