Archive:Getting Started/Build/Requirements: Difference between revisions

From KDE TechBase
(Mention DBus threading bugfix for DBus ≥1.4)
Line 28: Line 28:


== D-Bus ==
== D-Bus ==
QtDBus and KDE are known to work with D-Bus versions 0.62, as well as 0.92 and upwards. Versions 0.60 and 0.61 may work too but are not tested. Versions 0.90 and 0.91 are known not to work. We recommend using post-1.0 release versions (at least 0.94), so consider upgrading if you haven't done so.
D-Bus is the messaging framework used to allow different programs on the system to communicate with each other. It is used by both Qt and KDE.


Get [http://www.freedesktop.org/wiki/Software/dbus dbus] from your distribution, current stable release is version 1.2. Additionally you will also need dbus-glib. Be sure to also install the corresponding lib- and -devel packages.
Get [http://www.freedesktop.org/wiki/Software/dbus dbus] from your distribution, current stable release is version 1.4. Additionally you will also need dbus-glib. Be sure to also install the corresponding lib- and -devel packages.
 
If you need to build it manually, latest release is [http://www.example.com link title http://dbus.freedesktop.org/releases/dbus/dbus-1.2.24.tar.gz]


D-Bus 1.4.0 or higher is highly recommended as it fixes a bug when multiple threads access the same session bus. D-Bus 1.2 series should work (aside from that issue) but you should upgrade as soon as feasible.


== CMake ==
== CMake ==

Revision as of 04:22, 25 September 2010


Getting_Started/Build/KDE4/Prerequisites


Building KDE4 From Source/Prerequisites
Tutorial Series   Getting Started
Previous   [[../|KDE SVN Quickstart Guide]]
What's Next   [[../|KDE SVN Quickstart Guide]]
Further Reading   n/a

Abstract

Some or all of these packages should be available for installation from your distribution. For ease of installation and upgrading it is a good idea to install distribution packages if a recent enough version is provided. Software required to build KDE4 includes:

  • gcc and g++, preferably version 4.2 or higher
  • svn, the subversion revision control client
  • pkg-config
  • development libraries and headers for X11, OpenGL (mesa-common-dev and libglu1-mesa-dev), libjpeg, libpng, libungif, librdf, libxml2 and libxslt
  • the makeobj script, which is included in kdesdk. You can install it from kdesdk (kdesdk-scripts on Debian) or similar packages, or download at WebSVN
  • the shared-mime-info package, is the freedesktop MIME standard now used in KDE
  • the shared-desktop-ontologies package is required to build and run all Nepomuk semantic desktop/desktop search modules.
  • boost, used by kdebase; after build and/or install, in order to make cmake aware about its location (FindBoost), add the boost directory (which contains the include subdirectory) to CMAKE_INCLUDE_PATH or set a environment variable called BOOST_ROOT that points to the boost directory.
  • DocBook XML DTDs (v4.2) and related XSL stylesheets, used by KDE help system; their packages are available in most distributions

D-Bus

D-Bus is the messaging framework used to allow different programs on the system to communicate with each other. It is used by both Qt and KDE.

Get dbus from your distribution, current stable release is version 1.4. Additionally you will also need dbus-glib. Be sure to also install the corresponding lib- and -devel packages.

D-Bus 1.4.0 or higher is highly recommended as it fixes a bug when multiple threads access the same session bus. D-Bus 1.2 series should work (aside from that issue) but you should upgrade as soon as feasible.

CMake

You need to have CMake >=2.6.4 installed. You should be able to directly use the binary packages available on the CMake site. There are also distribution specific packages available.

Qt

Next we need to get Qt4. KDE 4.3 builds against Qt 4.5, however KDE trunk requires Qt 4.6. If you plan to build trunk on an ongoing basis, it is probably easier to track kde-qt, especially as KDE trunk may occasionally require a pre-release version of Qt.

Most up-to-date distributions will have packages of sufficiently new Qt to build the latest KDE stable branch. Some distributions may even package kde-qt; if so, using it is a viable option. If the distribution you use does not provide packages of the necessary version of Qt, it will be necessary to use the recipe below. More information can be found in the sections of the tutorial specific to each distribution.

Building qt4.4 with the -no-qt3support option will cause things to break.

README

Please read the README.kde-qt file for the necessary Qt configure options as well as currently known issues.

The Recipe

cs    # Note: cs is not a typo. See  .bashrc 
git clone git://gitorious.org/+kde-developers/qt/kde-qt.git qt-kde
cd qt-kde
./configure [copy/paste configure line from README.kde-qt replacing <installdir> with $QTDIR]
make -j2 # use 'make -j(X+1)' where X is your number of processors, to compile faster
make install

Note that you need to install Qt and Phonon from Qt and then later to install Phonon KDE from git at the same location. This will ensure you get sounds in Qt-based applications as well as in KDE ones.

If ./configure produces errors about missing headers, run the following command before trying again: QTDIR=`pwd` bin/syncqt

Make sure which qmake delivers something out of $QTDIR, e.g.:

/home/kde-devel/qt-kde/bin/qmake

What's Happening

We switch back to the kde-devel user's home directory (line 1) and download the source code, KDE branch, from gitorious using git (line 2). After changing into the resulting qt-kde directory (line 3), we then set up the build using the configure script (line 4). The various command line options used are explained in the qt-kde/README.kde-qt file. Finally, we build the minimal requirements for KDE (line 6) and install (line 9) Qt. If install dir is the same as the current dir (line 7), then we just free some space (line 8) instead. If you want all the example and demo applications, you can either build them individually or simply do a make from the qt-kde directory.

Note that the installation does not require root as it installs Qt locally into $QTDIR. Installation is necessary if $QTDIR differs from the source directory. In the end, we make sure the cmake macro to find the Qt directory will work. It must be able to find qmake in $QTDIR.

Troubleshooting

If you get "error: X11/Xlib.h: No such file or directory", install the devel package of xorg (the actual name may vary between operating systems, for example it is xorg-dev on Ubuntu based systems such as Kubuntu).

If you get an error in the configure step about missing defines, check the value of $QMAKESPEC. Some distributions set this to point directly to the system-installed Qt. If unset QMAKESPEC solves the problem, you probably want to add it to the ~/.bashrc script.

If you get an error ".pch/debug-shared/QtCore", this is because Qt-4.3 enables precompiled headers if your gcc supports it, but for some reason it doesn't work for you. If you use distcc, configure qt with -no-pch. If you use icecream, update to the latest icecream from svn trunk.

Try running any Qt program, like assistant. Note: You may need to run xhost +local:kde-devel as your regular kde3 user to run this application. If it crashes in QSpanData::adjustSpanMethods, then your problem is the oxygen style. Try removing lib/kde4/plugins/styles/kstyle-oxygen.so and lib/kde4/plugins/styles/oxygen.so if they exist in the KDE install prefix.

Generating local API documentation

It's nice to have the Qt documentation locally for nice integration with KDevelop, and doing this is really quite easy (also shown in README.kde-qt):

cd $KDE_SRC/qt-kde
make docs
./config.status
make install

Note that it is necessary to do this only once, even if you rebuild Qt later.

HAL

Tip
You can use qdbusviewer to see if you have org.freedesktop.hal. If not, you might need a newer version of hal. If you have org.freedesktop.hal, you probably don't need to, and don't want to, roll your own HAL.


If your system requires you to build a newer version of HAL, there's a decent chance you'll need to build other stuff as well, some of which may not be straight forward. This, however, should only be required for older distros.

kdesupport

Warning
Don't forget to read the Setting Up The Environment section first.


There are several libraries that KDE applications rely on in the kdesupport module. This includes Strigi and Soprano for file metadata and search, QImageBlitz for image manipulation needed in kdebase, eigen for visual effects in applications such as Kalzium, taglib for music players and qca for some cryptographic needs.

Strigi itself has a few dependencies as well: you will need the libraries and headers for libz, libbz2, openssl (libcrypto or libssl), libclucene (>=0.9.16a but watch out: version 0.9.17 does not work), and either libxml2 or libexpat.

Phonon is not in kdesupport anymore but in a git repository.

There is a new dependency: DBusMenu.

Please remember that if you use openSUSE, you can install the needed packages from the KDE:KDE4 buildservice repository and do not have to bother with fiddling the details below. Skip to the kdelibs section.

The Recipe

cs # 'cs' is a bash function, click here to learn more
svn checkout svn://anonsvn.kde.org/home/kde/trunk/kdesupport/
cd kdesupport
cmakekde

What's Happening

We change to the base source directory (line 1). We download the sources in kdesupport using subversion (line 2), go into the new ~/kde/src/kdesupport directory (line 3), and commence the build (line 4). This will leave us in the kdesupport build directory after the build is completed.

Troubleshooting

If you get

  cmakekde: command not found

then you have to go manually into the kdesupport directory in ~ and execute the command cmakekde. if this still doesn't work, then something is wrong with your bashrc.

If you get

CMake Error: This project requires some variables to be set,
and cmake can not find them.
Please set the following variables:
LIBXML2_INCLUDE_DIR (ADVANCED)

you should install the development package for libxml2.

If you get

CMake Error: Could NOT find REDLAND

then you need librdf from the Redland. If your distribution does not provide the librdf package, you can download the source there: http://download.librdf.org/source/ and build it. (Gentoo users: The ebuild for librdf is named dev-libs/redland)

If you get

Fetching external item into 'kdesupport/admin'
Error validating server certificate for 'https://...'

see Using Subversion with KDE

If you get

FILE cannot create directory: /usr/lib[64]/qt4/plugins/crypto. Maybe need administrative privileges.

make: *** [install] Error 255

take a second look in the .bashrc file described above, are paths correct? ($QTDIR and $PATH are used to get the QT installation path) Alternatively, you may see this error if you decided to use a distribution installed version of qt4 and skipped the Qt install above. Either install qt-kde as describe above, or "sudo make install". If you use "sudo make install", make sure that you change the ownership back to your user for some of the ~/kde subdirectories that were effected by using sudo (ie. "sudo chown -R kde-devel:kde-devel ~/kde").

If you get a message related to

  target libQtTest.so not found

you may need to recompile qt-kde. This time you should take out

  -nomake demos -nomake examples

from the configure command, so that Qt generates library QtTest.


If you get

     CMake Error: Qt qmake not found!

Then:

     1) uncomment Qt section in .bashrc script (QTDIR, QT_PLUGINS_DIR,      
           PKG_CONFIG_PATH variable settings).
     2) source ~/.bashrc
     3) cd && cd qt-kde
     4) make confclean
     5) repeat steps for installing Qt (from ./configure line).
     6) retry building kdesupport

If you get

     "CMake Error: Could NOT find BZip2"

then

     sudo apt-get install libbz2-dev

or

     urpmi libbzip2_1-devel

If you get

     message that MySql support cannot be enabled

then

     you need to install corresponding devel package. (libmysqlclient-devel  for SuSe 11.1)

Phonon

Phonon is not in kdesupport anymore but in a git repository. You need to build it as Phonon from Qt is not enough for KDE sound to work.

The Recipe

cs # 'cs' is a bash function, click here to learn more
git clone git://gitorious.org/phonon/phonon.git phonon
cd phonon
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$QTDIR -DCMAKE_BUILD_TYPE=debugfull \-DKDE4_BUILD_TESTS=TRUE
make 
make install

Note that you need to install this Phonon in the same location than Phonon from Qt i.e. in $QTDIR.

Troubleshooting

If you get an error like

designer: symbol lookup error: /path/to/kde/lib/kde4/plugins/phonon_backend/phonon_xine.so: undefined symbol: _ZN6Phonon12PulseSupport11getInstanceEv

while running Qt Designer you need to:

rm $QTDIR/lib/libphonon.so.4

DBusMenu

Since the 26th April 2010, DBusMenu is a new dependency for kdebase. You can either get it from http://people.canonical.com/~agateau/dbusmenu/index.html as a tarball (latest is libdbusmenu-qt-0.6.3.tar.bz2) or from its it repository

The Recipe

cs # 'cs' is a bash function, click here to learn more
git clone git://gitorious.org/dbusmenu/dbusmenu-qt.git dbusmenu
cd dbusmenu
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$KDEDIR -DCMAKE_BUILD_TYPE=debugfull \-DKDE4_BUILD_TESTS=TRUE
make 
make install

Troubleshooting

You need json to build the tests.

If your version is not correct, you will lose the context menu for the systray icons.

Shared-Desktop-Ontologies

Website: http://sourceforge.net/projects/oscaf/files/

The Recipe

cs # 'cs' is a bash function, click here to learn more
svn co https://oscaf.svn.sourceforge.net/svnroot/oscaf/trunk/ontologies
cd ontologies
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$QTDIR -DCMAKE_BUILD_TYPE=debugfull 
make 
make install

Next Step

Once all requirements have been installed it is time to install [[../#kdelibs|kdelibs]]