Some distributions (*Buntu, Arch) are now making Qt5 the defaulft! That does not work. Do not try to use Qt5, use Qt4. Make sure packages like qt4-default are installed. You might have to also switch your default Qt setup with a tool like qtchooser.

Requirements

Required software components

C++ compiler, e.g. gcc

Qt 5.4.0 or newer (both libraries and development files/tools)

Extra CMake Modules (ECM) 1.8.0 or newer

KDE Development Frameworks (KF5) 5.16.0 or newer (both libraries and development files/tools; can be installed from packages or see the Frameworks page for build instructions; https://kdesrc-build.kde.org can be used for a quick and easy build)

ICU (both libraries and development files; packages are usually called: icu, libicu and libicu-devel)

Detailed requirements are displayed on configure stage, KDb won't try to build if they are not met. You can also look for the "find_package" lines in the top level CMakeLists.txt file.

PostgreSQL Server installation is not needed for building KDb or software that uses it. The server is needed only for running the actual database service. Any installation on separate (e.g. remote) machine can be reused.

For MySQL support: libmysqlclient 5.x or newer (both the access library and development files)

Note

MySQL Server installation is not needed for building KDb or software that uses KDb. The server is needed for running actual database service. Any installation on separate (e.g. remote) machine can be reused.

Sybase/MSSQL and xBase support is disabled for now --Jstaniek (talk) 14:14, 9 October 2014 (UTC)

Get the source code

Download KDb source code as explained on the Download page. The root directory of the source code is referred as {kdb-source-dir}, and the root build directory is referred as {kdb-build-dir}.

Configuration

Configuration Variant 1: for global installation

Not recommended for developers, instead see Variant 2 below. You can install KDb in the global PREFIX ({kdb-install-prefix} = /usr by default), but this is not recommended as can be in conflict with existing or future installations, e.g. binaries installed from packages. Type:

and the configuration step will display you the current selection of options. Following sections are available:

"The following features have been enabled" - with explanation of each feature

"The following OPTIONAL packages have been found" - sometimes with required version

"The following REQUIRED packages have been found" - sometimes with required version

"The following features have been disabled" - useful to see more features that you can enable

TODO: To avoid installing to global a location such as /usr, for whatever reason, for your convenience, config-for-local.sh script has been prepared with default configuration settings. You can find it in tools/ subdirectory of the source code. Use it as follows:

1. Make sure $PREDICATE_INSTALL_PREFIX environment variable is set to directory that is indended PREFIX for the local Predicate installation, e.g. $HOME/predicate/inst.

2. To have the Predicate installation work environment variables PATH, LD_LIBRARY_PATH, PKG_CONFIG_PATH, QT_PLUGIN_PATH should be set properly. Double check this:

===Variant 3: Configuration for re-using local KDE 4 installation===
Here is recommendation of a directory structure:

$HOME/kde4/src/predicate

{predicate-source-dir}

$HOME/kde4/build/predicate

{predicate-build-dir}

$HOME/kde4/inst

directory that Predicate will be installed in, shared with other locally installed KDE software

If you use local KDE 4 installation, e.g. for developed applications, for your convenience, config-for-kde.sh script has been prepared with default configuration settings. You can find it in tools/ subdirectory of the source code. Use it as follows:

1. Make sure $KDEDIRS environment variable is set to directory that is intended PREFIX for the local KDE 4 installation, e.g. $HOME/kde4/inst.

2. To make the Predicate installation work, environment variables PATH, LD_LIBRARY_PATH, PKG_CONFIG_PATH, QT_PLUGIN_PATH should be set properly. Several of these are probably already set for the local KDE 4 installation but better double check this:

Debugging options

Recommended for accurate debugging: The default debug setting is RelWithDebInfo which is suitable only for obtaining backtraces. If you are developing code that uses KDb or developing KDb itself you may want to precisely set breakpoints, watch points, use step by step command accurately in your debugger, rely on assertions, debug and warning messages. If this is the case, you can replace -DCMAKE_BUILD_TYPE=RelWithDebInfo cmake option with:

-DCMAKE_BUILD_TYPE=Debug

Using Debug results in a slower code. That can be acceptable in most cases during testing and development given the machine is fast enough. It is not intended for production releases of the software unless you know what you're doing.

Enabling tests

To build with tests enabled (both unit tests and functional tests), add -DBUILD_TESTING=ON to the cmake command before building.

Build

For any configuration option: Type the above configuration command only once, to configure the cmake-based buildsystem. Then just type:

make
make install

Reconfiguration

To completely reconfigure, remove the {kdb-build-dir} directory completely and repeat the configuration process.

Speed up the build

Recommended: Taking advantage of multi-core processors. On dual-core machines compilation can be greatly speed up with the -j parameter of the make program. For example whenever you are invoking make, for dual-core processor try to invoke:

make -j3

Similarly, for quad-core processor:

make -j5

Generaly for N-core processor use the -jN+1 parameter.

Recommended: Faster linking on Linux.Linking can take noticeable time in large software such as Calligra. On Linux Gold linker can be used to speed up this task. If you're building for Linux, install the Gold linker package and add the following to your cmake command: