Calligra/Building Calligra on Windows: Difference between revisions

From KDE Community Wiki
Line 106: Line 106:
  cd kde4\build\calligra</nowiki>
  cd kde4\build\calligra</nowiki>
  cmake -DCMAKE_INSTALL_PREFIX=<nowiki>..\..\inst</nowiki> <nowiki>..\..\kde4\src\calligra</nowiki> -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTINY=off -DBUILD_active=off -DBUILD_mobile=off -DBUILD_flow=off -DBUILD_kexi=off -DWITH_Soprano=off
  cmake -DCMAKE_INSTALL_PREFIX=<nowiki>..\..\inst</nowiki> <nowiki>..\..\kde4\src\calligra</nowiki> -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTINY=off -DBUILD_active=off -DBUILD_mobile=off -DBUILD_flow=off -DBUILD_kexi=off -DWITH_Soprano=off
''cmakekde'' tool can be used as explained on [http://techbase.kde.org/Getting_Started/Build/KDE4 the build instructions for KDE4].


Then type:
Then type:

Revision as of 09:12, 6 December 2011

Note

These instructions are a work in progress, being based on the Linux Build instructions, there are some sections which need updating.


These instructions are for Unix and similar operating systems.

See also:


Preparation

Recommended setup

Here is recommendation of a directory structure:

C:\kderoot
KDE on Windows root directory
%USERPROFILE%\kde4\src\
source code
%USERPROFILE%\kde4\build\calligra
directory that Calligra will be built in
%USERPROFILE%\kde4\inst\
directory that Calligra will be installed in

The build directory is needed because you cannot (or should not) build Calligra inside the source directory; the source and build directory have to be separated.

You can create this structure by opening a command prompt (cmd.exe) and typing:

cd %USERPROFILE% 
mkdir kde4
mkdir kde4\build
mkdir kde4\build\calligra
mkdir kde4\inst
mkdir kde4\src


Getting the source code

As Windows support is still being improved, it is recommended that you use the development version. If you require stability, it is recommended that you take advantage of the nightly builds.

The latest development version of Calligra is 3.1.0 Alpha; developers always refer to it as to Master. Once tested and released, it will become the new current stable version 3.1.


To retrieve the source code from Git you have to use the following setup:

Add the following text to %USERPROFILE%\.gitconfig:

[url "git://anongit.kde.org/"]
    insteadOf = kde:
[url "ssh://[email protected]/"]
    pushInsteadOf = kde:
[core]
    autocrlf=false

Then execute

$ git clone kde:calligra

By using the kde: prefix, read access will automatically happen over Git, and authenticated SSH is only required for pushes.

Note that pushing your changes will only work if you have a KDE developer identity (https://identity.kde.org/register.php).

This will create a 'calligra' subdirectory with the complete source tree.

Build requirements

This section provides information about hard (required) and optional software packages needed to build the Calligra software.

Hard dependencies

Note

A note for developers: to add (or remove) a hard dependency, an explanation of the reason, and possibly a discussion must be posted in advance on [email protected]. 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.


Following are the general must-have dependencies for Calligra:

  • Qt 4.6.0 or newer
  • kdelibs and kdelibs development files
    • the minimal requirement is currently 4.3.0, any 4.3, 4.4 or 4.5 release packaged in your distribution is OK
  • kdebase/runtime 4.3 or newer
  • cmake 2.6.2 or newer
  • lcms 1.18 or newer
  • libpng development package (libpng14-devel on opensuse, libpng-dev on Ubuntu/Debian)

For Tables:

  • libeigen 2.0

For Krita:

  • libeigen 2.0
  • libexiv2 >= 0.16
  • libqimageblitz

For Stage:

  • boost

For Kexi:

  • sqlite3 and sqlite3-devel packages (package names can differ on various distributions), version >= 3.6.16

Optional dependencies

All optional dependencies are logged at the end of the cmake run, so it is easy to figure out what is missing. The buildsystem also reports what component will bot be built because given missing dependency.


Build Calligra

Note

It is not possible to build Calligra in the source directory. Set up your directories as described in the Recommended setup section above


From your home directory, type:

cd kde4\build\calligra</nowiki>
cmake -DCMAKE_INSTALL_PREFIX=..\..\inst ..\..\kde4\src\calligra -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTINY=off -DBUILD_active=off -DBUILD_mobile=off -DBUILD_flow=off -DBUILD_kexi=off -DWITH_Soprano=off

Then type:

jom

Note

jom -j2 or jom -j4 can be used instead of jom to force the maximum number of processes to spawn


This will take a while, once it has completed, type this command to install the software:

jom  install


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

Updating the already built software

If the source code has been checked out, it is possible to update the source code with newly added changes and build again. Usually only changing parts will be built, so this operation would be faster than building the source code from scratch.

Type:

cd %USERPROFILE%\kde4\src\calligra
git pull
cd %USERPROFILE%\kde4\build\calligra
jom
jom install

Build only selected applications from Calligra

You can edit the cmake command line, with "-DBUILD_{application}=off" from the cmake command line.

Running Calligra applications

There are two options to make the Calligra applications available for running.

  • Option 1: Being able to run Calligra applications from the command line. If you have installed Calligra in a different prefix than KDElibs (which was recommended in this document), you may want to set the following environment variable:
export KDEDIRS=/path/to/install:$KDEDIRS
export PATH=/path/to/install/bin:$PATH
export KDEHOME=/path/to/a/config/dir

And then you need to execute:

kbuildsycoca4

For example for the recommended directory structure:

export KDEDIRS=$HOME/kde4/inst:$KDEDIRS
export PATH=$HOME/kde4/inst/bin:$PATH
export KDEHOME=$HOME/kde4/.kde

It is important to set KDEHOME to a directory different of $HOME/.kde, and if the directory does not exist, it will be created automatically.

  • Option 2: Being able to run Calligra applications from the menu or by clicking on desktop icons. Instead of using KDEDIRS, you can add these lines to $HOME/.kde/share/config/kdeglobals file using text editor:
[Directories]
prefixes=/path/to/install

And then you need to execute:

kbuildsycoca4

The advantage of this is that KDE4 will always look for the services where Calligra is installed. For example for the recommended directory structure:

[Directories]
prefixes=$HOME/kde4/inst.

Executing unit tests

To be able to execute 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 in the build directory:

cd $HOME/kde4/build/calligra
cmake -DKDE4_BUILD_TESTS=ON .

Or you can run XXX ccmake . XXX in the buld directory and set KDE4_BUILD_TESTS to "on".

It is then recommended that before running the tests, you first execute

jom install

You can then run the test by executing:

jom test

or individually in the tests directories.

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

Possible issues

If you get errors when running an application like:

krita(8565)/calligra (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 Calligra installed through your package manager. As emphasized earlier in this document, you can only have one version of Calligra, and you should uninstall your packaged Calligra.