Building/Building KOffice

From KOffice

Jump to: navigation, search

These instructions are for Unix and similar operating systems.

There are also KDE on Windows techbase pages about compiling on Windows, and Mac OS X. There is also a community howto specially for Kubuntu on https://wiki.kubuntu.org/CompilingKoffice2

Contents

Preparation

First, make sure you do not have KOffice installed through the package manager of your distribution.

Example of setup

Here is an example of a possible directory structure:

  • $HOME/kde4/src -> source code
  • $HOME/kde4/build -> directory that KOffice will be built in
  • $HOME/kde4/inst -> directory that KOffice will be installed in

This is because you cannot build KOffice inside the source directory; the source and build directory have to be separated. This layout also has the advantage that you can use David Faure's scripts to make development easier. With those scripts you can type "make" in the source directory and building will happen in the right directory.

Also, check the Techbase instructions on setting up a build environment. That contains some useful scripts and functions as well.

Get the source code for the latest stable version

  • check on koffice.org for the latest release (currently it is 2.2.0)
  • you can checkout the 2.2 branch from:
cd $HOME/kde4/src
svn co svn://anonsvn.kde.org/home/kde/branches/koffice/2.2/koffice

This will create directory $HOME/kde4/src/koffice.

Get the source code for the development version

  • you can get the latest source from subversion:
cd $HOME/kde4/src
svn co svn://anonsvn.kde.org/home/kde/trunk/koffice

This will create directory $HOME/kde4/src/koffice.

Generally speaking, trunk is pretty stable and is the best choice if you want to test KOffice.

  • or of a beta

The source code for the latest beta can be found on KDE's ftp koffice-latest. Uncompress the code so that $HOME/kde4/src/koffice is created.

  • daily snapshots can be found here ftp://ftp.kde.org/pub/kde/snapshots/ (there is no guarantee that the content of the snapshot is buildable), and once installed it can be updated using subversion. Uncompress the code so that $HOME/kde4/src/koffice is created.
  • Back here, it takes forever for a new svn checkout. So,
    • Download svn trunk snapshots from http://kdesvn-build.kde.org/other/svn-checkout-tarballs.php. Uncompress the code so that $HOME/kde4/src/koffice is created.
    • svn revert -R .
    • If you have an svn account: svn switch --relocate svn://anonsvn.kde.org/ svn+ssh://username@svn.kde.org/ (replace svn+ssh by https if you are using the https protocol)

Get the source when you have a KDE developer account

For more information see using subversion with KDE. If you have https access (it's apparently no longer available option!):

cd $HOME/kde4/src
svn co --username=login https://svn.kde.org/home/kde/trunk/koffice

Or if you have svn+ssh access:

cd $HOME/kde4/src
svn co --username=login svn+ssh://svn.kde.org/home/kde/trunk/koffice

This will create directory $HOME/kde4/src/koffice.

Build requirements

Hard dependency

For developers: to add (or remove) a hard dependency, an explanation of the reason, and possibly a discussion must be posted in advance on koffice-devel@kde.org. The new dependency need to be packaged in the most widely used distributions (Debian, Fedora Core, OpenSuSE, (K)ubuntu). First try to make your new feature optional.

  • Qt 4.6.0
  • kdelibs, the minimal requirement is currently 4.3.0. But KOffice should build fine with either kdelibs from svn (see techbase for an explanation on how to compile kdelibs from svn), or any 4.3, 4.4 or 4.5 release packaged in your distribution (4.4.x is recommended)
  • kdebase/runtime 4.3 (4.4.x is recommended)
  • kdepimlibs 4.3 (4.4.x is recommended)
  • cmake 2.6.2
  • lcms 1.18

For KSpread:

  • libeigen 2.0

For Krita:

  • libeigen 2.0
  • libexiv2 >= 0.16
  • libqimageblitz

For Kexi:

  • sqlite and sqlite-devel packages, version >= 3.6.16

Optional dependency

All optional dependencies are logged at the end of the cmake run, so it is easy to figure out what you are missing.

On deb based distribution (debian/ubuntu/...)

You can install all the dependencies used for the packages by running "apt-get build-dep packagename", for instance on ubuntu:

sudo apt-get build-dep koffice-kde4

On OpenSuSE

You can install all the dependencies used for building koffice on OpenSuSE with:

zypper si -d koffice2

Build koffice

It is not possible to build KOffice in the source directory. Set up your directories as described in Example of Setup

  • cd $HOME/kde4/build/koffice
  • cmake -DCMAKE_INSTALL_PREFIX=$HOME/kde4/inst $HOME/kde4/src/koffice -DCMAKE_BUILD_TYPE=RelWithDebInfo

(or you can use cmakekde if you followed the build instructions for KDE4)

  • make

Note that if you have a dual-core machine you can speed up compilation with the -j parameter -- -j4 for dual-code, -j8 for quad-core.

  • make install

Instead of "RelWithDebInfo" which give an optimized KOffice with debug information, useful for bug reporting, one can use "Debug" to get a slow KOffice but with even more interesting backtrace information.

Please follow the Running KOffice Applications instructions before trying to run an application.

To be up-to-date

Only if yo have checked out trunk or a branch, it will not work if you have downloaded a source release.

  • cd $HOME/kde4/src/koffice
  • svn up
  • cd $HOME/kde4/build/koffice
  • make
  • make install

Build only selected applications from KOffice

CMake comes with a command-line tool ccmake that lets you configure build options. You can use it after executing cmake and before executing make. To use it, go to the build directory and issue the following commands:

cd $HOME/kde4/build/koffice
ccmake .

For applications that you do not want to compile, set the corresponding BUILD_{application} variable to "off", replacing {application} by the app's name. For instance, setting BUILD_krita to off will prevent Krita from being built.

Alternatively you can run "-DBUILD_{application}=off" from the cmake command line.

Running KOffice applications

To run KOffice applications you need to call it from the command line. If you have installed KOffice in a different prefix than KDElibs (which you are highly advised to do if you used packages), you need to set the following environment variable:

  • export KDEDIRS=$KDEDIRS:/path/to/install
  • export PATH=$PATH:/path/to/install/bin

Instead of using KDEDIRS, you can add this to your ~/.kde/share/config/kdeglobals (the advantage of this is that KDE4 will always look for the services where KOffice is installed):

[Directories]
prefixes=/path/to/install


In case you followed the example directory structure:

  • export KDEDIRS=$KDEDIRS:$HOME/kde4/inst
  • export PATH=$PATH:$HOME/kde4/inst/bin

And then you need to execute "kbuildsycoca4".

Run unit tests

To be able to run unit tests, you need to explicitely enable them in the build configuration. To do so, set the KDE4_BUILD_TESTS variable to "ON", either by issuing the command cmake -DKDE4_BUILD_TESTS=ON, or by running ccmake .. Both commands must be executed in the build directory.

You can then run the test with make test, or individually in the tests directories. It is recommended to call make install before running tests.

CMake Build Options

When you enter your build directory, you can type "ccmake ." to see many build options, e.g. you can turn off compilation of apps you don't want - you can save time when compiling.

Here is list for Krita related options:

  • HAVE_MEMORY_LEAK_TRACKER [On/Off] - You can turn on compilation of the tool in krita which detects memory leak. If you want to help debug Krita memory usage, it is useful. Otherwise you just slow down your Krita.
  • HAVE_BACKTRACE_SUPPORT [On/Off] - It is related to the memory leak tool. If you activate, you will be able to see code path which leads to memory leak.

Resources

Problems

If you get errors when running an application like:

krita(8565)/koffice (lib komain) KoPluginLoader::load: Loading plugin "Animation Tool" failed, "Cannot load library /home/michael/kde4/inst/lib/kde4/kpresentertoolanimation.so: 

(/home/michael/kde4/inst/lib/libkopageapp.so.7: undefined symbol: _ZN28KoShapeContainerDefaultModel3addEP7KoShape)" ( 1 )

or crashes when starting an application, then you very likely have a version of KOffice installed through your package manager. You can only have one version of KOffice, and you should uninstall your packaged KOffice.

Building FreOffice inside the Qt SDK

If you want to build FreOffice using the Qt SDK to deploy directly on the N900, please refer to the Nokia Qt SDK for Maemo PDF file.

Views
Personal tools