Software Development Kit 4.2

Installation Guide

The LibreOffice 4.2 SDK comes with a set of development tools, base libraries, header files and helper class files that can be used to develop Java/C++ components, to embed the LibreOffice 4.2 application in your own programs, or to use the API (scripting or remote control the office). For a complete working environment, we have some additional requirements:

LibreOffice 4.2 installation The SDK works on top of an existing office installation and uses the same libraries as the office installation.
JDK (1.5 or higher)

A JDK is necessary for developing Java components or applications. An appropriate Java SDK can be found on http://java.sun.com/products.

Recommendation is to use Java 6 excepting for Mac OS because initially Mac OS supported a 64bit version of Java 6 only.

Note: The Java compiler is optional!

C++ compiler A C++ compiler is necessary for developing C++ components or applications. UNO depends on a compiler dependent language binding, so that we use the appropriate compiler where a language binding exists:
Solaris Sun Studio 8 (20070730)
Linux GNU C++ compiler, gcc version 4.0.1
Windows Microsoft C++ Compiler, Microsoft Visual Studio 2008 or the Express version (cl, version 15.00.21022)

Note: The C++ compiler is optional! If you use the Express edition you have to ensure that the Microsoft Visual Studio 2008 Redistributable Package is also installed. You can download this package from Microsoft directly.

Microsoft .NET Framework SDK version 1.0 or higher The SDK is required for building CLI applications. That is, programs written in languages, such as C# or VB.NET.

Note: The .NET Framework is optional!

GNU make (3.79.1 or higher)

GNU make is used to build the examples of the SDK. GNU make is available from http://www.gnu.org. It can be ftped via ftp://ftp.gnu.org/gnu/make

Note: Windows user can find an executable of gnu make under http://www.mingw.org/wiki/Getting_Started (see the mingw32-make link under "Manual Installation"). Do not use the Cygwin make, because it does not work well. On Solaris gnu make can be found often under /usr/sfw/bin/gmake, but keep in mind that you have to use 'gmake' then. Or you can find gnu make also under http://www.sunfreeware.com/.

zip tool (2.3 or higher) The zip tool is used to create UNO packages. zip is a new requirement to make the SDK independent of a Java SDK.
If you do not have these already, you can download them from http://www.info-zip.org. Note: The cygwin zip.exe does not work for the build under the 4NT shell. You have to use the native w32 version.
cat and sed tools The cat and set tools are used to create some extensions.

Note for Windows users: If you do not have these already, you can download them from http://sourceforge.net/projects/unxutils/files/latest/download.

The SDK provides an implicit configuration mechanism, which configures the SDK build environment to your personal needs the first time you use the SDK environment. This configuration step creates a new setsdkenv_XXX script in the user's home directory:

  • $HOME/$OO_SDK_NAME/setsdkenv_unix.sh  -> for Unix
  • C:\Documents and Settings\<username>\Application Data\%OO_SDK_NAME%\setsdkenv_windows.bat  -> for Windows2000/XP or later

The automatically started configure script (Unix and Windows2000/XP) requests relevant information and directories (SDK, LibreOffice, GNU make, Java, C++), in order to prepare a working SDK environment. After completing the configure script once, the newly created script is always used to set the necessary environment variables for using the SDK and the required tools.

On UNIX operating systems, the configure script uses Perl. LINUX systems should have installed a working Perl version, and on Solaris you can find a working Perl version under http://www.sunfreeware.com/ if necessary. On Windows, the configure script uses Windows Script and a JScipt. If you have problems with Windows Script, you can download a newer version of Windows Script.

On other versions of Windows, use the batch file template <OO_SDK_HOME>\setsdkenv_windows.template, rename it to *.bat, and adapt it to your local environment.

If you use the template batch file, edit and set the following variables:

OFFICE_HOME Path to an existing LibreOffice base installation, e.g. "/opt/libreoffice8". Be sure that it is not a user installation only. Exactly one of OFFICE_HOME and OO_SDK_URE_HOME must be set. The other should be either unset or set to an empty value.
OO_SDK_NAME The configuration uses the directory name of the SDK, but you can use another name as well. It is important that the name does not contain spaces, because of a limitation of gnu make which cannot handle spaces correctly. This name is, for example, used to create an output directory in the users home directory for any generated output when you use the SDK build environment.
OO_SDK_URE_HOME Path to an existing UNO Runtime Environment installation, e.g. "/opt/libreoffice/ure". Exactly one of OFFICE_HOME and OO_SDK_URE_HOME must be set. The other should be either unset or set to an empty value.
OO_SDK_HOME Path to the SDK root directory, e.g. "/opt/libreoffice/sdk"
OO_SDK_JAVA_HOME Path to a JDK root directory. The JDK is optional and only necessary if you like to run the Java examples or if you like to use the SDK environment to develop your own Java solution.
OO_SDK_CPP_HOME Path to the C++ compiler (on Windows, the directory where the "vcvar32.bat" file can be found). The C++ compiler is optional and only necessary for building the C++ examples.
OO_SDK_CLI_HOME Path to the C# compiler and VB.NET compiler (on Windows, this directory can be found under the system directory (e.g. c:\WINXP\Microsoft.NET\Framework\v1.0.3705). The compilers are optional and only necessary for building the CLI examples.
Note: Windows only!
OO_SDK_MAKE_HOME Path to GNU make.
OO_SDK_ZIP_HOME Path to the 'zip' tool.
OO_SDK_CAT_HOME Path to the 'cat' tool.
OO_SDK_SED_HOME Path to the 'sed' tool.
OO_SDK_OUTPUT_DIR Path to an existing directory where the example output is generated. The output directory is optional, by default the output is generated in the SDK directory itself. If an output directory is specified, the output is generated in a SDK dependent subdirectory in this directory (e.g. <OO_SDK_OUTPUT_DIR> /LibreOffice 4.2/LINUXExample.out)
SDK_AUTO_DEPLOYMENT If this variable is set, the component examples are automatically deployed into the Office installation referenced by OFFICE_HOME. See also chapter "Extension Manager - unopkg" from the Developer's Guide. This variable is only relevant when OFFICE_HOME is set.

You must run the setsdkenv_XXX script every time you want to use the configured SDK environment. The settings are local for the current shell on Windows or the new started shell on UNIX. On UNIX you can now source the prepared environment script file ("setsdkenv_unix.sh") to prepare your current shell instead of starting a new shell.

Manual Setting

If you do not want to use the script to set your working environment, you must set the appropriate environment variables yourself. The script sets the following environment variables:

Common Environment Variables

OO_SDK_NAME See description above.
OO_SDK_URE_BIN_DIR The path within the chosen office or URE installation where binary executables are located (e.g., $OFFICE_HOME/program for an office installation, or $OO_SDK_URE_HOME/bin for a Unix URE installation).
OO_SDK_URE_LIB_DIR The path within the chosen office or URE installation where dynamic libraries are located (e.g., $OFFICE_HOME/program for an office installation, or $OO_SDK_URE_HOME/lib for a Unix URE installation).
OO_SDK_URE_JAVA_DIR The path within the chosen office or URE installation where Java JARs are located (e.g., $OFFICE_HOME/program/classes for an office installation, or $OO_SDK_URE_HOME/share/java for a Unix URE installation).
CLASSPATH =$OO_SDK_URE_JAVA_DIR/juh.jar; $OO_SDK_URE_JAVA_DIR/jurt.jar; $OO_SDK_URE_JAVA_DIR/ridl.jar; $OO_SDK_URE_JAVA_DIR/unoloader.jar; [$OO_SDK_URE_JAVA_DIR/unoil.jar;] $CLASSPATH

The classpath will be set or extended to the necessary jar files of the specified office installation. (unoil.jar is only included when OFFICE_HOME is set.)

OFFICE_PROGRAM_PATH =$OFFICE_HOME/program

This variable is used to find, for example, the office type library and the UNO package deployment tool. This variable is only relevant when OFFICE_HOME is set.

UNO_PATH =$OFFICE_PROGRAM_PATH

This variable is used to ensure that the new C++ UNO bootstrap mechanism uses the configured office installation of the SDK. Normally the bootstrap mechanism finds the default office installation for the user on the system. This variable is optional but is set from the scripts to ensure a homogeneous environment. Especially useful during development where you might have more than one office installation installed. This variable is only relevant when OFFICE_HOME is set.

Environment Variables for UNIX

Solaris

LD_LIBRARY_PATH =$OO_SDK_URE_LIB_DIR: $OO_SDK_HOME/(solsparc|solintel)/lib: $LD_LIBRARY_PATH

The LD_LIBRARY_PATH will be set or will be extended by the office/URE library path, the platform dependent lib directory for several additional libraries.

PATH =$OO_SDK_HOME/(solsparc|solintel)/bin:$OO_SDK_MAKE_HOME: $OO_SDK_ZIP_HOME: [$OO_SDK_CPP_HOME:] [$OO_SDK_JAVA_HOME/bin:] $OO_SDK_URE_BIN_DIR: $PATH

The PATH variable will be extended by the paths for the SDK development tools, the compiler, the JDK, GNU make, the zip tool and the OO_SDK_URE_BIN_DIR, where the compiler or the JDK are optional.

When OO_SDK_URE_HOME is set, the script additionally creates symbolic links to the public dynamic libraries of the URE in $OO_SDK_HOME/(solsparc|solintel)/lib, which are needed for linking.

Linux

LD_LIBRARY_PATH =$OO_SDK_URE_LIB_DIR: $SDK_HOME/linux/lib: $LD_LIBRARY_PATH

The LD_LIBRARY_PATH will be set or will be extended by the office/URE library path, the platform dependent lib directory for some additional libraries.

PATH =$OO_SDK_HOME/linux/bin:$OO_SDK_MAKE_HOME: $OO_SDK_ZIP_HOME: [$OO_SDK_CPP_HOME:] [$OO_SDK_JAVA_HOME/bin:] $OO_SDK_URE_BIN_DIR: $PATH

The PATH variable will be extended by the paths for the SDK development tools, the compiler, the JDK, GNU make, the zip tool and the OO_SDK_URE_BIN_DIR, where the compiler and the JDK are optional.

When OO_SDK_URE_HOME is set, the script additionally creates symbolic links to the public dynamic libraries of the URE in $OO_SDK_HOME/linux/lib, which are needed for linking.

Environment Variables for Windows

PATH =%OO_SDK_HOME%\windows\bin; %OO_SDK_MAKE_HOME%; %OO_SDK_ZIP_HOME%; [%OO_SDK_CLI_HOME%;] [%OO_SDK_CPP_HOME%;] [%OO_SDK_JAVA_HOME%\bin;] %OO_SDK_URE_BIN_DIR%; %PATH%

The PATH variable will be extended by the paths for the SDK development tools, the compiler, the JDK, GNU make, the zip tool and the OO_SDK_URE_BIN_DIR.

LIB =%OO_SDK_HOME%\windows\lib; %LIB%

The LIB variable will be extended by the path to the import libraries that are necessary for Windows.

In addition to setting these environment variables, the script calls the "vcvar32.bat" batch file which is provided by the Microsoft Developer Studio to set the necessary environment variables for the compiler.