Difference between revisions of "Documentation/Building Guide/Building on Windows"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Download and install MS compiler and tools: iso images for Express version)
(Downloading and installing Java and other tools)
Line 173: Line 173:
All OOo builds can be done with [http://java.sun.com/j2se/1.4.2 JDK 1.4.2]. If your build is based at least on milestone m158 you can also use [http://java.sun.com/j2se/1.5.0  JDK 1.5.0.] Don't use Java 1.6, at least the hsqldb modules does not build with that version. This is status quo with milestone m218.
All OOo builds can be done with [http://java.sun.com/j2se/1.4.2 JDK 1.4.2]. If your build is based at least on milestone m158 you can also use [http://java.sun.com/j2se/1.5.0  JDK 1.5.0.] Don't use Java 1.6, at least the hsqldb modules does not build with that version. This is status quo with milestone m218.
If a self contained Windows installer is desired in addition to the MSI installer files [http://nsis.sourceforge.net/ NSIS] is needed, but it is optional. If NSIS is not present the build will ignore this step.
If a self contained Windows installer is desired in addition to the MSI installer files [http://nsis.sourceforge.net/ NSIS] 2.0.4 is needed, but it is optional. If NSIS is not present the build will ignore this step. Using newer version of NSIS will probably break the build ([http://qa.openoffice.org/issues/show_bug.cgi?id=85657 #85657]).
= Getting the source code =
= Getting the source code =

Revision as of 17:20, 30 January 2008

Building OpenOffice.org on Windows

This document tries to fill a gap. The existing documentation about building OOo on Windows mainly reads like “Building OOo on Windows explained for Linux developers”. I will collect and summarize this existing documentation, fix some of its errors and try to add some comments that address people that are already developing on Windows and now want to get to know about building OOo. So this document is also for those who are not used to unix like command line interfaces, tar balls etc. Of course you must be familiar with a command line, but you don't need to be a shell wizard. But on the other hand it wouldn't hurt if you are. :-)

I collected information from several places, e.g.:


Building on Windows

Perl modules installation with CPAN


The first problem with them is that there are many of them (there are even more than the mentioned four!). So you have to collect things by yourself and have to sort out non-Windows parts. Additionally some of the places contain outdated, incomplete or even wrong information. So I hope that my commented summary might come in handy for starters.

If this documentation is not enough for you or if you have a problem that is not addressed you can send a mail to the mailing list dev@openoffice.org (subscription is recommended) or you can meet OOo developers on IRC in the channel #dev.openoffice.org at freenode.de. If you just want to give some feedback about the documentation please also use the mailing list.

You might want to know how many time and disk space installing the build environment will cost you. For a rough estimation I give some download, install and build times. They have been measured on an Athlon 64 X2 3800 (2GHz) dual core machine with 1GByte RAM and a 300 GB SATA disk. My internet connection is a 8MBit DSL broadband connection.

I created this document for building OOo using Microsoft Visual Studio 2005 Express, the “free” (as in beer) offering from Microsoft. It also works with Microsoft Visual Studio 2003, the small differences are mentioned in the text. Using Microsoft Visual Studio 2005 (without the “Express”) should work also but until now I have only one known case as a proof for this.

Building works fine on Windows XP. It should work also on Windows 2000. I have no information about it but I assume that using Windows 98/ME is not a good idea (Visual Studio Express 2005 cannot be installed on Windows 98, so you'd probably need the full version of Visual Studio 2003 - but Windows 98 is EOL anyway Cloph). I don't know anything about building on Vista.

The first thing you need is the build environment. We are using Cygwin, a Windows program that emulates a complete Unix command line environment.

Download and install Cygwin

Go to http://www.cygwin.com und download the current version. If you already have Cygwin installed: you will need at least version 1.5.10. If you are using version 1.5.18 you must download a special version of the cygwin1.dll as described here. But in general I would recommend to use a recent version.

Cygwin has a web based installation process that is described here. I used the “Install from Internet” method and it worked like a charm. Make sure that you tell the setup to use the “Unix/binary” file type. Cygwin consists of some basic and a lot of optional packages. As building OOo needs some of these optional packages you have to select them in the installer. Unfortunately the list of packages mentioned at the place describing the installation process is incomplete, some more are listed here. Here's a complete list of the needed packages:

  • Category Archive: unzip, zip
  • Category Devel : autoconf, bison, cvs, flex, gcc-g++, make, openssl-devel (only needed for perl modules for CWS tooling, see below)
  • Category Libs: openssl
  • Category Net: openssh, ncftp
  • Category Perl: perl (Perl)
  • Category Shells: rxvt, tcsh
  • Category Utils: patch, gnupg
  • Category Web: lynx, wget

The installer will automatically check and download some more packages needed by thosed listed here. The total amount of disk space is 46 MB for the download and 174 MB for the Cygwin installation, including all the additional Perl modules shown below. The whole process took roughly 20 minutes.

Within the Cygwin Toolkit, some executables might be symlinks, in the version I have downloaded (1.5.24-2) it was awk.exe and gunzip.exe, older documentation also mentioned tar.exe. This can lead to a break of the build later, and the symlinks should be replaced by copies of the command they link to.

You can check this in the cygwin shell by calling e.g.

ls -l /bin/awk.exe

whether e.g. awk.exe is a symlink. In version 1.5.24-2 awk.exe is a link to gawk.exe. The shell will show this by putting out “awk.exe -> gawk.exe”. In this case gawk.exe must be copied to awk.exe by executing:

cd /bin
rm awk.exe
cp gawk.exe awk.exe

Take similar action for gunzip.exe that I found to be a link to unzip.exe.

In case you overlook something here or you have a newer Cygwin version with additional symlinks not mentioned here it's not a problem. You will get a helpful error message about an existing link in the configuration step (configure) later. The message will tell you which link you have to remove and you can do it following the advice given above for the awk.exe/gawk.exe pair.

Cygwin uses the command line shell “bash” by default and I always use this shell for everything I do with Cygwin. Building OOo is also possible using the shell “tcsh”, though some problems have been reported (see below). My recommendation is to use bash.

Though bash is the recommended shell you shouldn't try to deinstall tcsh. Cygwin doesn't have a simple mechanism to deinstall something automatically and it's still possible that one of the tools used for the build is using the tcsh internally because the script calling it doesn't evaluate the environment variable pointing to the shell to use. So it's safer to keep tcsh installed even if you use bash.

All commands written in this document are meant to be used in a bash (except explicitly told differently). In case you are not used to Unix command line shells you will need to familiarize yourself with some basic commands, but explaining that in closer detail is beyound the scope of this documentation. If you use the shell only for building the source all shell commands you will need are “cd” for the navigation between directories and “rm” in case you want to remove something. Use the “man” command to get more information (e.g. by calling “man cd”) or the “--help” option of the commands to get a short information about the basic options.

Download and install MS compiler and tools

Currently building on Windows needs a Microsoft Visual Studio C++ compiler (2003 or 2005 version). The “regular” builds are done with Visual Studio 2003 that is available from Microsoft at a price. Building using the free (as in “free beer”) compiler Visual Studio 2005 Express works fine and is explained here.

You can download the “Express” compiler from Microsoft. The download is a setup.exe with 2.8 MB. If the setup is started it downloads additional content from the Web. You only need to select the Graphical IDE. More can be downloaded later if you want, but for building and debugging OOo you will not need more than the basic package. The download and installation took me roughly 10 minutes and 220 MB on my hard disk. Note: In case you don't have broadband connection at home or have other problems using the web-based installer, you can download ISO-images (~450 MB) from the Manual Installation site (german site)

Next step when you plan to use the “Express” version is installing the Microsoft Macro Assembler (MASM). MASM is part of the paid version of Visual Studio (so you can skip that part if you are using it) but for the “Express” version you have to download it separately. It's only a very small download. I had a problem with the MASM installer on all machines where I used it: the setup started but then suddenly disappeared from the screen. I found a hanging msiexec.exe in the task manager and had to kill it manually. Fortunately the MASM was obviously installed correctly. It appeared in the “Add and remove software” dialog and the “ml.exe” was installed to “Vc/Bin” folder of VC8.

You also must download and install the Microsoft Windows Platform SDK. The usual instructions recommend to download it from here but I followed the recommendations from the Visual C++ site. There you can find a link (download requires Genuine Windows Validation). The setup is again web based. You can either user the “Typical” installation or select “Custom” setup and deselect the packages you don't need. You need at least the following packages:

  • Microsoft Windows Core SDK
  • Microsoft Web Workshop (IE) SDK
  • Microsoft Internet Information Server (IIS) SDK
  • Microsoft Data Access Services (MDAC) SDK
  • Microsoft DirectShow SDK
  • Microsoft Windows Installer SDK

You can deselect all 64Bit parts of these packages, all samples, all source code modules and (if you want) every documentation. In total the installation filled 438 MB of my harddisk space (including the documentation, but without all other optional parts).

Warning: the first installation option is called “Register Environment Variables” and it is deselected by default. You shouldn't change this as selecting it will add directories with blanks to your PATH variable. This (or more precisely the quotes surrounding them) will cause troubles in Cygwin (see below). It is also possible that other installed Windows programs (not only Cygwin) can't cope with the changed PATH variable as the installer of the Platform SDK explicitly warns.

The only drawback of not selecting this option is that if you wanted to use the platform SDK for other projects except OOo you would have to take care for the correct environment yourself. The platform SDK creates some start menu entries for shells with a suitable configured environment so that shouldn't be a problem.

There is a library called “libcp.lib” in the “Lib” directory of the SDK; it must be either moved away or renamed. You can read more about this here.

There is another thing you have to change in the Platform SDK: you have to apply a small patch to one of the Platform SDK header files as described here.

Another SDK that could be downloaded and installed is the Direct X9 SDK. If you don't want to download it you can disable DirectX support in the configuration step (“--disable-directx”). The current regular builds of OOo are done with a version of the DirectX SDK that is no longer available for download so it's necessary to search for a download link in the Web. The OOo pages mention several links, outdated as well as working links. I took the one from here (Genuine Windows Validation required). This is a 509 MB download as the setup is not Web based. Downloading, unpacking and installing took 30 minutes. As I deselected the sources and sample the resulting installation only was 189 MB.

Download of additional files

You have to download some more files that you have to put into some prepared locations of the OOo source tree later. I mention it here because most of them are related to the MS compiler but perhaps it makes more sense first to download the source so that you can immediately copy the addtitional files to the proper location. Here's the list of files to download (with links) and the locations in the source tree where you must put them:

GDI+ Redistributable (Genuine Windows Validation required) external/gdiplus
unicows.dll external/unicows
dbghelp.dll external/dbghelp
instmsiw.exe and instmsia.exe external/msi
msvcp80.dll and msvcr80.dll (found in c:\WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd/msvc external/msvcp80
GPC Unpack to external/gpc
Mozilla binary distribution



msvcr71.dll and msvcp71.dll for Mozilla libraries (search for them in the Web) external/msvcp71

All the files except GPC, the Mozilla binaries and the ms...80.dll can be found in any OOo 2.x installation set also so you can save the download by “stealing” it from your OOo installation.

The Mozilla files are necessary as OOo uses some Mozilla components. Building the corresponding sources is not possible with the VC2005 compiler so you have to use the precompiled libraries. They have been compiled with the MSVC2003 compiler and so you also need the msvx71 libraries mentioned above.

Downloading and installing additional Perl modules

As explained elsewhere in the wiki some perl modules must be installed with CPAN. The necessary command in the cygwin shell is

perl -MCPAN -e shell

If this command is executed the first time CPAN will ask for configuration. The autoconfiguration worked fine for me. I used the prompted installation just to see what is asked but always pressed “Enter” in each step, even in case I got an error message that asked me for confirmation. You can do the same and just ignore any error messages you might see (the same is true for all queries while you are executing the “install” command mentioned below).

Please note that CPAN is not able to deal with usernames containing spaces. To work around this fact, when CPAN asks you to specify the CPAN build and cache directory, change the default suggestion to /cpan.

At the end the CPAN shell appeared and is ready to accept commands for installations. Each module is installed by typing “install $MODULENAME”. The modules that must be installed are:

  • Archive::Zip
  • XML::Parser (though it seems that this is already installed; doesn't hurt to do it)
  • URI
  • LWP::UserAgent
  • SOAP::Lite
  • Crypt::SSLeay

The last three modules are only needed if you want to use the CWS tooling. These tools are necessary if you want to create and maintain your own Child Workspaces or if you want to build one of them. I recommend to install them anyway as sooner or later you want to work on a child workspace.

CPAN will detect if a selected module depends on other modules and it will offer to download them also. As explained please just confirm this.

Downloading and installing Java and other tools

Some OOo components as well as some build tools of OOo require Java. So you must download a JDK and the Java make utility Ant. It's not necessary to read the whole installation instructions from Ant. After downloading the zip package just unpack the bin and lib folders from it into a directory that you specfiy as ant-home in the configure step later. The path to this directory must not contain blank characters!

All OOo builds can be done with JDK 1.4.2. If your build is based at least on milestone m158 you can also use JDK 1.5.0. Don't use Java 1.6, at least the hsqldb modules does not build with that version. This is status quo with milestone m218.

If a self contained Windows installer is desired in addition to the MSI installer files NSIS 2.0.4 is needed, but it is optional. If NSIS is not present the build will ignore this step. Using newer version of NSIS will probably break the build (#85657).

Getting the source code

You will place your code somewhere in your file system. In the following text this root directory will be called SRC_ROOT.

Source code is available via CVS or as a source tarball. Downloading and unpacking the latter needs less bandwidth but tarballs are not available for every milestone build. If you wanted to work on a particular milestone or CWS you have to get the source directly from the cvs.

We have some documentation about working with cvs on OOo. Here's a short description how you can download the whole OOo2 source. You have to use the following commands to get e.g. the milestone m206 (with the cvs branch tag SRC680_m206):

export 'CVSROOT=:pserver:anoncvs@anoncvs.services.openoffice.org:/cvs'
cvs login ( use the CVS password: anoncvs when you are asked for it)
cvs co -r SRC680_m206 OpenOffice2

“OpenOffice2” will check out all modules that are needed for OOo2.x; it is also possible to check out single modules. Checking out OpenOffice2 took me roughly an hour. If you already have a cvs tunnel working you can of course use this one instead of the anoncvs access I used in my example but anoncvs is much faster as it does not have the SSL overhead and latency.

If you got the tarball, e.g. the one for version 2.2.0, you can unpack it with

tar -xvzf Ooo_2.2.0_src.tar.gz

There's a great script from Kay Ramme that checks out any project or modules and – using the build lists of the modules and the dependencies created from them – all other modules that are needed for a successful build. It uses several parallel cvs connections (anoncvs allows to use 3) and so should be a bit faster. I used the script several times and it took roughly 40 minutes. But if you wanted to go the safe way you should use the checkout via the “OpenOffice2” target.

Once you have the source tree you can copy all the extenal files listed in the table above into the appropriate locations.

Of course you will not want to use the milestone m206 for your builds, it will be outdated already when you read this document. Whatever milestone (version) of OOo you want to use, never try to build the HEAD revision! As new files are committed to HEAD quite often when workspaces are integrated into the main code lines it is very likely that you start to check it out while committing of files is still in progress. The result will be an incomplete and inconsistent version that most probably won't build. The OOo versioning works in a way that release engineers commit files to HEAD and give these files a version tag for the next milestone, e.g. “SRC680_m206”. Once this version is built and tested sucessfully it is announced to be usable for developers and the race is on for the next round.

If you want to know which milestones are current please look into our “Environment Information System” (EIS). There is an RSS feed available that informs you about new available milestones. You can also subscribe to the cws-announce@openoffice.org mailing list (or look into its archive).

EIS also provides a lot of other useful information and entry points to more documentation.

Setting up the build environment

Finally the “configure” tool is used to create the environment. It checks that all software, hardware, and system requirements for the build are satisfied, and creates configuration files called winenv.set (for tcsh) and winenv.set.sh (for bash) that are used to set all necessary build environment variables. If configure detects a problem it will stop and give you a useful (really!) hint how to fix it. You have to call “configure” from the SRC_ROOT/config_office directory.

The resulting configuration files are created in the SRC_ROOT directory. A top-level makefile script makefile.mk and the script bootstrap that are located in the config_office directory are moved into SRC_ROOT folder as well. This is due to technical reasons: The SRC_ROOT directory in the cvs tree can only hold directories. On the other hand, the top-level makefile.mk should logically be placed in the top-level directory SRC_ROOT. The cvs tree holds these files in config_office and configure copies them up.

Before running configure, make sure that all needed programs are in the system path or start configure with the appropriate command line switches. Make also sure that the PATH variable in your cygwin shell does not contain any blanks and quotes.

There are a number of options that you can use with the configure script. To display these options, type the following command:

./configure –help

Here's my configure call (the folders of the different programs of course might be different in your case):

./configure \
--with-directx-home=/cygdrive/c/Programme/MicrosoftDirectXSDK \
--with-cl-home="/cygdrive/c/Programme/Microsoft Visual Studio 8/VC" \
--disable-activex \
--disable-build-mozilla \
--with-frame-home="/cygdrive/c/Programme/Microsoft Visual Studio 8/SDK/v2.0" \
--with-psdk-home="/cygdrive/c/Programme/Microsoft Platform SDK" \
--with-midl-path="/cygdrive/c/Programme/Microsoft Platform SDK/Bin" \
--with-asm-home="/cygdrive/c/Programme/Microsoft Visual Studio 8/VC" \
--with-jdk-home="/cygdrive/d/openoffice.org/r/j2sdk1.4.2_11" \
--with-csc-path="/cygdrive/c/Windows/Microsoft.NET/Framework/v2.0.50727" \

You might notice that many paths contain spaces and quotes. Obviously configure managed to convert them into the short file names so that the PATH variable I got later on is fine. For whatever reason this didn't work for the DirectXSDK so that I bit the bullet, deinstalled it and reinstalled it to a path without blanks (as you can see in my configure script).

Most parameters are self-explanatory, but some options might need an explanation.

The Visual Studio 2005 Express compiler does not contain everything needed to build the OOo ActiveX control so I disabled it here. If you are using a “complete” Visual Studio (no “Express” version) you can omit this if you want. But the ActiveX control is not needed to run OOo, it's just an additional feature that lets OOo embed files into the Internet Explorer.

OOo uses some Mozilla components. As mentioned above it is not possible to build them from the sources using the Visual Studio 2005 compiler. So I disabled the build with an appropriate option. Disabling the Mozilla components completely is not recommended (at least not by me ;-)), using the binaries works quite fine.

Cygwin starts with a “bash” shell by default as already mentioned. My document explains how to build with this shell. Using a tcsh is possible though it may sometimes lead to problems (memory allocation errors, hanging builds) so I don't recommend to use it. Unfortunately using “tcsh” is still the default setting created by configure (as the first builds where done using it) and so I told configure that the bash should be used instead. If you want to try using tcsh remove the “--with-use-shell” parameter shown above and build with tcsh as explained below. In case the build breaks at some place you can manually patch your winenv.set.sh file and exchange the line




and the line




Then close the tcsh and build again with bash as explained below.

After running configure you must create the dmake make utility that is needed for the build of OpenOffice.org. This done from the SRC_ROOT directory by calling


If you experiment with the newest sources from the cvs-tree, mind that updates to the configure process may not happen via updates of configure (the script file) but via the files configure.in and set_soenv.in. The configure script itself is created from configure.in using the autoreconf command. The perl script set_soenv is created when you run configure from set_soenv.in.

If you need to modify or create a correct configure you would run commands like the following:

SRC_ROOT> cd config_office
config_office> cvs update configure.in
config_office> autoconf

to update the configure script. If you only use code from the snapshot releases on the web, you don't need to be concerned about this. If you are working on a Child Workspace you should rerun the configure script after each resync.

Build Instructions

Now you are ready to build OpenOffice.org. In every Cygwin instance used for building you have to set the environment variables from the generated configuration file(s).

If you are using bash got to your SRC_ROOT folder and call

. winenv.set.sh

or if you are using tcsh call

source winenv.set

Now you have two options to build the whole Office. You can either call “dmake” in SRC_ROOT or you can go to the “instsetoo_native” directory and use “build” that allows you to control the build process a bit better:

SRC_ROOT> cd instsetoo_native
SRC_ROOT> build --all -P4

The “-P4” tells the build tools to start 4 parallel running processes. Using more than one process will speed up the build as it avoids that CPU time is wasted waiting for disk i/o. As a rule of thumb twice as much processes as you have CPU cores is a good number, so “-P4” is fine for my dual core Athlon 64 X2. On this machine (described at the top of this document) the complete build took roughly 2,5-3 hours. The whole tree takes 8,1GB after a successful build.

Some build times for comparison (as reported by users):

  • Athlon XP 64 2 GHz, 1 GB RAM - 3 hours
  • Athlon 1,15 GHz, 1 GB RAM - 18,5 hours

There are some special things in the way how OOo builds its modules. Every module has an “output” folder (with some subfolders for the different kinds of generated output) that is created the first time a build is done in the module. The name of this folder is “wntmsci10.pro” for builds with MSVC++2003 and “wntmsci11.pro” for builds with MSVC++2005. After a successful build of a module some of the generated files are copied to the output folder of the “solver” module by executing a tool called “deliver” (this is automatically called by build --all for each of the modules). Other modules will take these “delivered” files (header files, libraries etc.) to resolve their dependencies. The content of the solver module will also be used to pack the installation sets in the final step.

Sometimes a build breaks. You will get an error message that tells you which modules have to be rebuilt. It seems that at least on Windows in rare cases the build (especially a multi processor build) breaks without an obvious reason and redoing the build is enough to “fix” the problem. I didn't experience that in the last months but don't be surprised if it happens to you. Of course a build can break for “real” reasons also if you changed something in the source code. “build” will always tell you the modules it couldn't build successfully and you can then go to any folder inside the module(s) and fix the problems.

The build system recommends to use the “--from” parameter of the build command to continue the build where it broke after you have fixed the problem. Rumours are that this is not reliable everytime. So if you can bear the extra minutes that “build” needs to detect already built modules you should restart your build with “build --all” from inside instsetoo_native as you did the first time just to avoid uncertainties. For more options of “build” call

SRC_ROOT> build – help

After a successful build you will find the OOo installation set in


“instsetoo_native” is the module that packs the installation set.

If you already have a version of OOo installed you can install your freshly built version in parallel by installing it with setup /a that just unpacks all files without any system registration.

If you decide to rebuild a module or build each module individually (mind dependencies!), you also will have to use the “build” tool from inside a folder of these modules. A “build” of a single module will not call “deliver” automatically as described above for the “build --all” case. You must call is manually to get the usual files copied to the solver tree so that other modules or the packaging module can use them.

SRC_ROOT/(module)> build
SRC_ROOT/(module)> deliver

You can copy all new files manually to the appropriate places in your installation. There's no need to rebuild and install the complete installation set if you only want to rebuild some parts.

Special Debug Builds with --enable-dbgutil

OpenOffice.org can be built in a "non-pro" version where special debug assertions are enabled. This is supported for Windows/Cygwin starting with the m218 milestone of the SRC680 codeline and all released code lines starting with OOo 2.3.

To enable this kind of build you must add the "--enable-dbgutil" switch to your "configure" command line. If you are building with a MSVC 2005 compiler and you didn't disable the mozilla parts you will also need the debug DLLs for the MSVC2003 compiler runtime, msvcr71d.dll and msvcp71d.dll. You can download them from the internet and copy them into the external/msvcp71 folder.

In milestones older than SRC680m223 you also have to change the d.lst file in the external/prj folder. Add the following lines:

..\msvcp71\msvcp71d.dll %_DEST%\bin%_EXT%\msvcp71d.dll

..\msvcp71\msvcr71d.dll %_DEST%\bin%_EXT%\msvcr71d.dll

You can build the non-pro version in the same source tree as the pro-version, all created files go into wntmsci10 or wntmsci11 folders, without the "pro" extension as in case of the "normal" builds.

When you work with the non-pro version you will see some error messages or warnings at times. In most cases you can safely assume that you have found a bug. The non-pro version is a bit slower than the pro version.

Personal tools