Windows Build Dependencies

From The Document Foundation Wiki
< Development
Revision as of 2012-04-16T15:54:22 by Llunak (Talk | contribs) (Windows now can build in /home)

Jump to: navigation, search

Install Cygwin Requirements

On Windows, you must first install cygwin from www.cygwin.com.

The easiest thing to do is to download the cygwin SETUP.EXE. Then run cmd and navigate to the download dir and copy and paste the below to run setup.exe preselected with the list of required packages

  setup.exe -P autoconf,automake,bison,cabextract,doxygen,flex,gcc-g++,git,gnupg,gperf,libxml2-devel,libpng12-devel,make,mintty,openssh,openssl,patch,perl,pkg-config,readline,rsync,unzip,vim,wget,zip   

This launch 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.

Alternatively, Run the setup.exe utility, switch the package view mode to 'Full' by pressing 'View' until 'Full' is displayed beside it, then select the following packages for installation:

  1. autoconf
  2. automake
  3. bison
  4. cabextract
  5. doxygen
  6. flex
  7. gcc-g++
  8. git
  9. gnupg
  10. gperf
  11. libxml2-devel
  12. libpng12-devel
  13. make
  14. mintty
  15. openssh
  16. openssl
  17. patch
  18. perl
  19. pkg-config
  20. readline
  21. rsync
  22. unzip
  23. wget
  24. zip

As a safety measure, and because I always had to do it :
Once cygwin installed, close all cygwin consoles, run c:\cygwin\bin\dash.exe, and in the terminal, launch /bin/rebaseall.

Install Windows Build Requirements

Microsoft Visual Studio 2008 Express C++ and C# Editions
(or one of the better editions that cost money)
http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
Java Development Kit
(use a 32bit SDK)
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Windows SDK (Ensure all redistributables are installed)
If you're not running the latest version of Windows, use the archive link on that page to get the correct version.
http://msdn.microsoft.com/en-us/windows/bb980924.aspx
Apache ANT
http://ant.apache.org/bindownload.cgi
Mozilla build tooling
http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe
GDI+ Redistributable
http://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en
DirectX Software Development Kit http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2c7da5fb-ffbb-4af6-8c66-651cbd28ca15&displaylang=en
Prebuilt mozilla modules (to be copied to moz/zipped)
http://dev-www.libreoffice.org/mozilla/

Notes

Where to put the source code/Git checkout

On Windows you have to be careful where you put your LibreOffice source code.

You should pay attention to the length of the full path to the directory where you put the LibreOffice source code, as Windows places a severe limit on the maximum path length that is easy to run into. Experience indicates that a path like C:/git/libo is short enough.

Cygwin Shell

You will use Cygwin Bash Shell for the whole build process. You must installed all the build dependencies above before starting the shell to run autogen because autogen need some environment variables to find the tools.

Cygwin symlinks

Native Windows programs cannot use Cygwin symlinks. However, Cygwin's awk is a symlink to gawk. So gawk.exe must be copied to awk.exe by executing:

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

If you use Windows SDK 7+ with VS2008 Express, you should register it after install. You should do it with Start>Programs>Microsoft Windows SDK v7.1>Visual Studio Registration>Windows SDK Configuration Tool. If this does not work, open the SDK console (one step up), and execute: WindowsSdkVer.exe -version:v7.1 -legacy (Thanks to Chromium build instructions).

Pre-built Mozilla libraries

For the pre-built Mozilla libraries, you need MSVC 2005 runtime files Microsoft.VC80.CRT.manifest, msvcp80.dll, and msvcr80.dll in external/msvcp80. Those files should be in c:/windows/winsxs/ , under a folder beginning with x86_Microsoft.VC80.CRT. I put an asterisk in path because I did not have the same string as what is set in configure. If you don't have those files, you can get them by installing the redistributable package. and copying the aforementioned .dll files from:

c:/windows/winsxs/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_*

and the manifest from

c:/windows/winsxs/manifests/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_*.manifest

You should rename the manifest to Microsoft.VC80.CRT.manifest


Autogen options

Something like the following in the autogen.lastrun is known to produce a working build:

--with-max-jobs=5
--with-num-cpus=2
--disable-binfilter
--disable-build-mozilla
--disable-odk
--without-junit
--with-ant-home=/home/xyz/apache-ant-1.8.2
--with-mozilla-build=/home/xyz/mozilla-build

Of course, change the information behind ='s to fit your needs; eg. decrease the --with-max-jobs when you have smaller amount of cores( cf Development/How to build for more information), or set the paths to what you have used when installing various prerequisites.

Other than setting --with-num-cpus and --with-max-jobs, you also need --without-junit. You also need to specify the path for ant with --with-ant-home=<cygwin path of ant>. If your build fails because of Mozilla you may add --disable-mozilla but that also disable some features. If you use the free Visual Studio 2008 Express, then --disable-activex and --disable-atl, because only the full version of Visual Studio 2008 contains the required headers. Remember to restart the shell after you install Microsoft tools, before you run autogen.

Visual Studio 2010 compiler

We cannot yet build using the Visual Studio 2010 compiler. The build will fail in cli_ure (UNO bridge for C# binding). Stick with the Visual Studio 2008 compiler for now.

System PATH causing weird build breakage

The build imports the system PATH for DLL lookups. If you experience weird build breakage that no one else seems to experience, check your PATH value and try cleaning it. Note that you need to re-run configure in order for the new system PATH value to take effect in your build. For example, the author has experienced a build failture in the shell module due to his system PATH including a path to an older OOo installation which had a DLL of the same name as the one that the build uses.

Buildability of 'master'

If you are building the Windows build for the first time, it is recommended that you check the current state of http://tinderbox.libreoffice.org/MASTER/status.html . If you see recent "green" builds, it is a good time to try - otherwise it might happen to you that you'll have to fix the build yourself. The buildability on Windows has improved recently with the introduction of the MinGW and more stable native Windows tinderboxes, but still there might be a day or two when 'master' is not buildable on Windows.

The usual recommendation is to just pull and try again, and once you have a build, don't pull in the tree any more, but do your hacking in it. Clone a different tree and iterate pulling and building in that until it again works, then switch. Repeat.