User:Hossein/Build/Windows

This manual is for building LibreOffice for x64 Windows using x64 Intel or compatible processor and Cygwin. If this does match your platform, please refer to the development page on Wiki to find the correct build instructions.

LibreOffice Versions
This manual is written for the LibreOffice Dev 7.4, which is the latest git master.

Visual Studio
You need the Microsoft compiler/development suite Visual Studio. There is an edition that is free of charge, the Community Edition, that includes everything needed to build all LibreOffice features:


 * https://visualstudio.microsoft.com/vs/community/

The current master can be built with these versions of Visual Studio or the equivalent Visual Studio Build Tools:

Individual Components
Open the Visual Studio installer, select the Desktop development with C++ workload and check that all of the following components are selected individually:

Cygwin
Install Cygwin from www.cygwin.com. Download the 64 bit version from setup-x86_64.exe.

Individual Packages
Run cmd and navigate to the download folder. copy and paste the command below to run setup-x86_64.exe with the list of required packages preselected.

This launches the GUI and requires you to manually choose installation paths etc, but the packages passed via command line are pre-selected meaning you just need to accept the selection.

Java
You need Java Development Kit (JDK) Version 11 or later. Make sure that you download a 64-bit JDK. You can download it from different sources:
 * microsoft.com (Microsoft builds do not require login)
 * oracle.com (Oracle requires login to download)
 * adoptopenjdk.net (AdoptOpenJDK installer will not be auto detected by default installation. You have to enable the "JavaSoft (Oracle) registry keys" option)

Java is optional. If you want to avoid Java, use the  option in your.

Setup LODE
Choose a place where you want your LODE installation to be. You can put it anywhere you want —in your HOME directory is fine— but you need to have enough space there to have a LibreOffice build and more. Preserve at least 45 GB to be safe with one debug build environment.


 * Regina (talk) 2022-06-02T12:01:07 (UTC): This page is only for Windows, so the wordings like "For Windows users" are not necessary. There are other places too, for example "On Windows".

Clone the lode git repository:


 * Regina (talk) 2022-06-02T12:01:07 (UTC): I have not tested LODE, but for 'normal' way, I need to call 'git clone' from the target directory. Because this it for beginners, it should be mentioned, if that is true for LODE too.
 * Regina (talk) 2022-06-02T12:08:51 (UTC): You should mention how big the download is. Depending on the quality of the Internet connection, the download may take quite a while. Please mention an average download time.

Change directory to the  directory:

Read the help,  and the prerequisites for your platform:

Once you have met the prerequisites for your platform, run:

Read the notes at the end of the setup.

The setup program does not automatically adjust your shell profile file, since that may not be desirable in your environment. You need to make the necessary adjustment and make sure that the shell environment conforms to the requirements:

If your shell is Bash (Cygwin's default), add the environment variables into  or. Edit your profile file and add the following lines to it, replacing user with your user name:

One way to do that is issuing these commands directly from your terminal:

Restart your terminal: close the terminal window and open it again. On Windows, to start Cygwin run  (this is the default path). A restart is needed for Cygwin to use the new  environment variable from your profile.

If things went well, you can move to the right location and setup a dev build environment by running:

This will setup a  repository. By default it will configure  (the file where one puts the configuration options for the build) to make a debug build.

Build Configuration
In order to build LibreOffice, you need appropriate build configuration preferably in.

You should have a suitable configuration for the build. A sample  for building LibreOffice with Visual Studio 2022 can be:

Build
Make sure your anti-virus software will not cause any problems.

Then you can start to build LibreOffice:

After 1 to 2 hours, or more depending on your machine (Windows can take more than 8 hours for the first build), you will have a built LibreOffice. Consult the other pages on this wiki to go further or to deal with build problems.

Run LibreOffice
When the build has finished without errors, you can run your fresh build of LibreOffice using

Using LibreOffice with an IDE
An integrated development environment (IDE) helps developers to have a better coding experience. Considering the fact that LibreOffice has a very large code base, you may use an IDE to simplify coding, building and debugging LibreOffice. You can use several IDEs to work on LibreOffice, including Visual Studio, Visual Studio Code, Qt Creator, KDevelop, Vim, Eclipse CDT and several others.

You can refer to the wiki article Development/IDE to understand how to use IDEs.

Comments
1. I use jdk-9.0.1 without problems --Regina (talk) 2022-06-02T11:47:17 (UTC)
 * JDK 9 is usable, but it is no longer supported as of 2018: Java version history. Also, JDK 11 is used in building LibreOffice on CI. For above reasons, I think it would be reasonable to suggest JDK 11. I can add a note describing that JDK 9 also works, but it is not recommended. --Hossein (talk) 2022-06-07T09:59:42 (UTC)

2. "Java is optional" is dangerous, if you not list all things, which will not work. --Regina (talk) 2022-06-02T11:47:17 (UTC):
 * Let's rephrase the sentence as : Java is optional, but you may loose many features, described in Development/Java. --Hossein (talk) 2022-06-07T09:59:42 (UTC)