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

From KDE TechBase
m (Reverted edits by 89.149.195.132 (Talk) to last version by Dhaumann)
(lShiZYCkkaRzfD)
Line 1: Line 1:
{{Template:I18n/Language Navigation Bar|Getting_Started/Build/KDE4/Prerequisites}}
comment6,
 
{{TutorialBrowser|
 
series=Getting Started|
 
name=Building KDE4 From Source/Prerequisites|
 
pre=[[../|KDE SVN Quickstart Guide]]|
 
next=[[../|KDE SVN Quickstart Guide]]|
|
}}
 
== 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, [http://clucene.sourceforge.net/index.php/Downloads libclucene], [http://download.librdf.org/source/ librdf], libxml2 and libxslt
* the <tt>makeobj</tt> script, which is included in kdesdk. You can install it from kdesdk (kdesdk-scripts on Debian) or similar packages, or download at [http://websvn.kde.org/*checkout*/trunk/KDE/kdesdk/scripts/makeobj WebSVN]
* the [http://freedesktop.org/wiki/Software/shared-mime-info shared-mime-info package], is the freedesktop MIME standard now used in KDE
* [http://boost.org/ 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.
 
 
== 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.
 
You may skip this section if you have a recent D-Bus version or if you don't want to upgrade. You probably want to skip building the bindings until/unless you know you will be building HAL (see below).
 
Before running these steps in the recipe, make sure your X11 headers and libraries are available. The configure script run on line 5 of the following instructions should output:
Building X11 code:        yes
 
 
=== The Recipe ===
 
{{tip|Make sure you did set up your environment correctly as described [[Getting_Started/Build/KDE4#Setting_up_the_environment|above]]. This is necessary for the <tt>cs</tt> and <tt>cb</tt> functions to work.}}
(NOTE: on my intrepid installation, I had to additionally set my CFLAGS to '-D_GNU_SOURCE' for this to work)
 
cs # [[Getting_Started/Increased_Productivity_in_KDE4_with_Scripts/.bashrc|'cs' is a bash function, click here to learn more]]
wget http://dbus.freedesktop.org/releases/dbus/dbus-1.0.2.tar.gz
tar -xvzf dbus-1.0.2.tar.gz
cd dbus-1.0.2/
./configure --prefix=$DBUSDIR --localstatedir=/var
make
sudo make install
sudo dbus-uuidgen --ensure
 
cs # see above
wget http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.74.tar.gz
tar -xvzf dbus-glib-0.74.tar.gz
cd dbus-glib-0.74/
./configure --prefix=$DBUSDIR
make
sudo make install
cd
sudo chown -R kde-devel:kde-devel *
 
=== What's Happening ===
After changing into the source directory (line 1), D-Bus source code is downloaded from freedesktop.org (line 2) and unpacked (line 3). After going into the newly created D-Bus directory (line 4), the build is set up using the supplied {{path|configure}} script (line 5). After building (line 6) and installing (line 7) D-Bus, we use the <tt>dbus-uuidgen</tt> tool to install a machine identification file that allows the bus to start automatically when the desktop session starts (line 8).
 
Note that you need write access to {{path|/var}} for the last two steps. If your system does not have the sudo command, you can use the <tt>su</tt> command instead, e.g. <tt>su -c "make install"</tt>.
 
The steps for building the glib bindings are similar to the above.
 
When these two packages are done building, we must fix the file ownership because 'sudo make install' has created root owned files and directories in ~kde-devel/kde.
 
=== Troubleshooting ===
If you get the error:
"configure: error: DBus development libraries not found"
do this:
export PKG_CONFIG_PATH=/lib/pkgconfig/
 
== CMake ==
Skip this if you have [http://cmake.org/ CMake] >=2.6.2 installed.
You should be able to directly use the binary packages available on the [http://cmake.org/HTML/index.html CMake site]. There are also distribution specific packages available.
 
=== The Recipe ===
<!--'cs' and 'cb' are NOT typos!-->
cs # [[Getting_Started/Increased_Productivity_in_KDE4_with_Scripts/.bashrc|'cs' is a bash function, click Here to learn more]]
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
tar -zxf cmake-2.6.2.tar.gz
mkdir cmake-build
cd cmake-build
../cmake-2.6.2/bootstrap
make
sudo make install
 
=== What's Happening ===
First, we go back to the <tt>kde-devel</tt> user's source directory (line 1), get the CMake sources (line 2) and unpack them (line 3). We create a directory to build CMake in (line 4) and go into it (line 5). We then run the CMake bootstrap script to set up the CMake build (line 6), then make (line 7) and install it (line 8) using the root user.
 
If your system does not have the <tt>sudo</tt> command, you can instead do <tt>su -c "make install"</tt>.
 
== Qt ==
Next we need to get Qt4. KDE 4.0 builds against Qt 4.3, however KDE 4.1 and trunk require the Qt 4.4. A recent snapshot of Qt 4.4 is available in the qt-copy module. KDE 4 will not build against Qt 4.2 or earlier.
 
Most distributions have packages of Qt 4.3.  Some have packaged either the Qt 4.4 beta, or qt-copy as well.  If the distribution you use has done this, 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.
 
Please read the README.qt-copy file for the necessary Qt configure options as well as currently known issues.
 
=== The Recipe ===
cs # Note: cs is not a typo. See  [[Getting_Started/Increased_Productivity_in_KDE4_with_Scripts/.bashrc|<font color=red>.bashrc</font>]]
svn checkout svn://anonsvn.kde.org/home/kde/trunk/qt-copy
cd qt-copy
./apply_patches
./configure [copy/paste configure line from README.qt-copy replacing <installdir> with $QTDIR]
make -j2 # use 'make -j(X+1)' where X is your number of processors, to compile faster
# if we don't install, we'll just clear obj files to
# save disk space
if [ "$QTDIR" = "`pwd`" ]; then \
find . -name '*.o' -delete ; \
else make install; fi;
 
'''Make sure <tt>which qmake</tt> delivers something out of $QTDIR, e.g.:'''
/home/kde-devel/qt-copy/bin/qmake
 
=== What's Happening ===
We switch back to the <tt>kde-devel</tt> user's home directory (line 1) and download the source code using subversion (svn) from KDE's repository (line 2). After changing into the resulting {{path|qt-copy}} directory (line 3), we run a script that manages the patches that come with <tt>qt-copy</tt> (line 4).
 
Once the patches have been applied, we then set up the build using the <tt>configure</tt> script (line 5-6). The various command line options used are explained in the {{path|qt-copy/README.qt-copy}} file. Finally, we build the minimal requirements for KDE (line 7) and install (line 10) Qt. If install dir is the same as the current dir (line 8), then we just free some space (line 9) instead. If you want all the example and demo applications, you can either build them individually or simply do a <tt>make</tt> from the {{path|qt-copy}} directory.
 
Note that the installation does not require root as it installs Qt locally into {{path|$QTDIR}}. Installation is necessary if {{path|$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 <tt>xorg</tt> (the actual name may vary between operating systems, for example it is <tt>xorg-dev</tt> on Ubuntu based systems such as Kubuntu).
 
If you get an error in the configure step about missing defines, check the value of <tt>$QMAKESPEC</tt>.  Some distributions set this to point directly to the system-installed Qt.  If <tt>unset QMAKESPEC</tt> solves the problem, you probably want to add it to the <tt>~/.bashrc</tt> 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 {{program|assistant}}. '''Note:''' You may need to run <tt>xhost +local:kde-devel</tt> as your regular kde3 user to run this application.  If it crashes in QSpanData::adjustSpanMethods, then your problem is the oxygen style. Try removing {{path|lib/kde4/plugins/styles/kstyle-oxygen.so}} and {{path|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 [[Getting_Started/Set_up_KDE_4_for_development#KDevelop|KDevelop]], and doing this is really quite easy (also shown in {{path|README.qt-copy}}):
cd $KDE_SRC/qt-copy
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 [[Getting_Started/Build/KDE4#Setting_up_the_environment|Setting Up The Environment]] section first.}}
 
There are several libraries that KDE applications rely on in the kdesupport module. This includes Phonon, 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.
 
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' and 'cb' are NOT typos!-->
cs # [[Getting_Started/Increased_Productivity_in_KDE4_with_Scripts/.bashrc|'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 {{path|~/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/ 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 [[Getting_Started/Sources/Using_Subversion_with_KDE|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-copy 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. "<tt>sudo chown -R kde-devel:kde-devel ~/kde</tt>").
 
If you get a message related to
  target libQtTest.so not found
you may need to recompile qt-copy. 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-copy
      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
 
== Next Step ==
Once all requirements have been installed it is time to install [[../#kdelibs|kdelibs]]

Revision as of 02:22, 25 January 2009

comment6,