Building on Windows
Building Guide
|
Introduction Getting the source |
Contents
Overview
Template:Documentation/Windows
It requires that you are familiar with a command line, but not that you are a UNIX shell wizard.
If this document 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 2.x and 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. But meanwhile things have become even more complicated because on the way to OpenOffice.org 3.0 the compiler was changed again and now the recommended compiler is Visual Studio 2008 (Express). Please see [[1]] for more details.
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 unsupported for OpenOffice.org 3.0 anyway Cloph). I have no personal experience with building on Vista, but I got reports that it works in the same way.
The first thing you need is the build environment. We are using Cygwin, a Windows program that emulates a complete Unix command line environment.
Requirements
hardware requirements
- 1 or more reasonable fast CPUs (x-way CPU recommended)
- 1 GB RAM (2 GB recommended)
- 10 GB free disk space (20 GB when debugging)
software requirements
- Windows XP/Vista
- C/C++ Compiler:
alternatively, the Standard or better version of VS 2008
- Visual Studio 2003 is the reference compiler for OpenOffice.org 2.x
- Visual Studio 2008 is the reference compiler for OpenOffice.org 3.x
- Visual Studio 2005 Express should work fine
- Java:
- Windows SDK for Windows Server 2008. 1
- SDK Redistributable: GDI
- Cygwin Toolkit from with (dll version 1.5.10) or later
- unicows.dll from (Microsoft Layer for Unicode)2
- dbghelp.dll from Microsoft3
- Apache Ant (version 1.6.5 or later)
- prebuild Mozilla
- msvcr71.dll, msvcp71.dll
- Microsoft_VC90_CRT_x86.msm, Microsoft_VC90_DebugCRT_x86.msm, policy_9_0_Microsoft_VC90_CRT_x86.msm, policy_9_0_Microsoft_VC90_DebugCRT_x86.msm4
- general polygon clipper library release 2.31
- optional: Nullsoft Scriptable Install System (NSIS)5
- optional: DirectX SDK6
Installation and Preparation of Build Tools
Setting up Cygwin
Go to http://www.cygwin.com/ and download and install the current version. Template:Documentation/Note
Required additional packages
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. Here's a complete list of the needed packages:
- Category Archive:
- unzip
- zip
- Category Devel :
- autoconf
- bison
- flex
- gcc-g++
- gperf
- make
- openssl-devel (only needed for perl modules for CWS tooling, see below)
- cvs (for 2.x code line and 3.0 code line)
- subversion (for 3.x code line, minimum version 1.5.5)
- Category Libs
- openssl
- Category Net
- openssh
- ncftp
- Category Perl
- perl
- Category Shells
- rxvt
- Category Utils
- patch
- gnupg
- Category Web
- lynx
- wget
Breaking links to executables
Within the Cygwin Toolkit, some executables might be symlinks: awk.exe and gunzip.exe, tar.exe (in older releases only). This can lead to a break of the build later, and the symlinks should be replaced by copies of the command they link to.
To check this, execute:
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
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.
http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/GNU-Linux-Tools-Summary.html
Installing additional Perl modules in cygwin
As explained 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. Choose autoconfiguration.
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
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.
Adding required files to the build tree
Here's the list of files to download (with links) and the locations in the source tree where you must put them:
Where to get | Place in |
---|---|
GDI+ Redistributable (Genuine Windows Validation required) | external/gdiplus |
Only for OOo2.x but due to a bug in configure still needed for 3.x: unicows.dll | external/unicows |
dbghelp.dll | external/dbghelp |
instmsiw.exe and instmsia.exe | external/msi |
for 2005 compiler: 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 |
for 2008 compiler (until DEV300 m22): msvcp90.dll and msvcr90.dll (found in $(msvcdir)\Vc\redist\x86\Microsoft.VC90.CRT) | external/msvcp90 |
for 2008 compiler starting with DEV300m23: Microsoft_VC90_CRT_x86.msm and policy_9_0_Microsoft_VC90_CRT_x86.msm for non debug builds and Microsoft_VC90_DebugCRT_x86.msm and policy_9_0_Microsoft_VC90_DebugCRT_x86.msm for debug builds. These merge modules are available in VS08 Express Edition and VS08 Professional Edtion. All *.msm files are located at c:\Program Files\Common Files\Merge Module. | external/msm90 |
GPC | external/gpc |
Mozilla binary distribution
(WNTMSCIruntime.zip,WNTMSCIlib.zip,WNTMSCIinc.zip) |
moz/zipped |
msvcr71.dll and msvcp71.dll for Mozilla libraries (Search for them in the Web or on your PC. These files should be named as all lower case. Sometimes when downloaded they are upper case and this will cause 'file not found' errors towards the end of the build)) | external/msvcp71 |
Full Builds
configure
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. Before running configure, make sure that all needed programs are in the system path or start configure with the appropriate command line switches. If configure detects a problem it will stop and give you a useful hint how to fix it.
You will find the configure
script in $SRC_ROOT
. The resulting configuration files are created there too.
sample configure calls
./configure \ --disable-directx \ --with-cl-home="/cygdrive/d/develop/msvc/VC" \ --disable-activex \ --disable-atl \ --disable-build-mozilla \ --with-frame-home="/cygdrive/d/develop/MSDK/v6.1" \ --with-psdk-home="/cygdrive/d/develop/MSDK/v6.1" \ --with-midl-path="/cygdrive/d/develop/MSDK/v6.1/Bin" \ --with-asm-home="/cygdrive/d/develop/msvc/VC" \ --with-jdk-home="/cygdrive/d/develop/j2sdk1.4.2_11" \ --with-csc-path="/cygdrive/c/Windows/Microsoft.NET/Framework/v3.5" \ --with-ant-home=/ant \ --with-use-shell=bash
./configure --disable-build-mozilla --with-use-shell=bash --disable-activex --with-win32 --with-cl-home="/cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC" --with-midl-path="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1/Bin" --with-csc-path="/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v3.5" --with-frame-home="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1" --with-asm-home="/cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC/Bin" --with-jdk-home="/cygdrive/c/j2sdk1.4.2_11" . --disable-directx --disable-epm --with-ant-home=/cygdrive/c/apache-ant-1.6.5 --with-psdk-home="/cygdrive/c/Program Files/Microsoft SDKs/Windows/v6.1"
configure settings tips
Template:Documentation/Note Template:Documentation/Note Template:Documentation/Tip Template:Documentation/Tip Template:Documentation/Tip Template:Documentation/Tip Template:Documentation/Tip Template:Documentation/Tip Template:Documentation/Tip
Template:Documentation/Tip Template:Documentation/Tip
bootstrap
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
./bootstrap
setting the enviroment
When the configure script has been run successfully a file winenv.Set.sh
was created7. Do this:
source winenv.Set.sh
to set up the enviroment for the build.
starting the build
Build the software by typing the following in $SRC_ROOT
8:
dmake
The building procedure will take at least an hour (on a 3 GHz Quad-Core with 8GB RAM).
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, “wntmsci11.pro” for builds with MSVC++2005 and "wntmsci12.pro" for builds with MSVC++2008 (for the meaning of the "pro" extension see below). 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.
Partial Builds
There are two ways to do partial builds:
- compatible
- incompatible
Only do compatible partial builds if you know exactly what you are doing. Template:Documentation/Note
rebuilding from a module (incompatible build)
If you decide to change a module in an incompatible way, you will need to rebuild all modules depending on it (directly or indirectly):
cd $SRC_ROOT/instsetoo_native build --from $INCOMPATIPLEMODULE --prepare build --from $INCOMPATIBLEMODULE
rebuilding a module (compatible build)
To rebuild a module you can delete all output directories with, rebuild and redeliver into the solver with:
cd $MODULE build --from $MODULE --prepare build && deliver
A simple build
in $SRC_ROOT/instsetoo_native
will recreate the installation sets, provided all other modules have already been build.9
Building a module with Debug Information
To rebuild a module with debug information and additional assertions and checks, run:
cd $MODULE build --from $MODULE --prepare # removes old output trees and solver build debug=true --from $MODULE
Drop the newly created binaries into an existing installation. Building an installation set with them will not help, as binaries are stripped on packing by default.
Finding the installation sets
After a successful build you will find the OOo installation set in
instsetoo_native/wntmscixx.pro/OpenOffice/msi/Install/en-US
“instsetoo_native” is the module that packs the installation set.
Avoid using winzip
Avoid using winzip to extract the downloaded source archive. Observed problems include:
- CR-LF errors that can affect makefiles and cause compile errors
- Certain files unpacked into root folder, esp. likely when actual path is deeply nested (e.g. foo/bar/source/foo/java/org/x/y/z/w/LongFileName.hmm) which again causes mysterious compile errors.
Use the tar from Cygwin instead:
tar xvzf OOo_2.0.2_src.tar.gz
Installation and Preparation of Build Tools for older OOo versions
Visual Studio 2005 Express (OpenOffice.org 2.x)
In case you still can find a copy of the 2005 Express compiler setup and it still works 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. The complete (not Web based) compiler installation set still can be downloaded as an ISO-image (~450 MB) from the Manual Installation 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). WARNING: don't install the new Vista platform SDK that is needed for the 2008 Express compiler (see below), the 2005 Express Compiler does not work with it.
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.
See Also
Footnotes
1Template:Documentation/Note 2Template:Documentation/Note 3Template:Documentation/Note 4Template:Documentation/Note 5Template:Documentation/Note
It used to be that newer version of NSIS broke the build (see Issue 85657 ), but it seems that in now works for NSIS up to 2.3.7. |
Current (as of 2008/01) versions of the DirectX9 SDK and Windows Platform SDK do not fit to each other. To be able to build with DirextX enabled, you need to patch one file in the Platform SDK. See http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID2743771 for details. |
7Template:Documentation/Note 8Template:Documentation/Note
9Content on this page is licensed under the Public Documentation License (PDL). |