Howto - Build KDE 4 from SVN trunk on Ubuntu Hardy

KDE 10 Comments »

Like I mentioned earlier, I followed the guide here : http://techbase.kde.org/Getting_Started/Build/KDE4 to build the latest and greatest KDE 4 from trunk. Unfortunately though, I am having problems getting KWin Composite (all those effects) to work on my laptop (running Linux Mint 4.0) which has the ATI Mobility Xpress 200M chipset. It has the fglrx driver installed with XGL and Compiz Fusion works fine but KWin doesn’t play nice with that setup for some reason. I even tried installing fglrx 8.42.3 which has experimental AIGLX support, but no go. I really want to play with KWin in all its glory, so here I am, building KDE 4 again, on another machine - this time, my desktop, which has an Nvidia GeForce FX 5200 card. I thought it’d be nice to document the process, just in case somebody wants to see the latest from KDE as well.

This machine had Ubuntu Gutsy Gibbon (7.10)  on it which I dist-upgraded to Hardy Heron (8.04) a couple of weeks ago.

Before we begin, let me just tell you that this does not install KDE 4 “system-wide”. It is local to the user it is built under. You might want to create a new user and do this under that username.

1. Install all the prerequisite packages :
sudo apt-get install build-essential cdbs debhelper cmake kdesdk-scripts subversion ssh xserver-xephyr doxygen graphviz libqt4-dev dbus-x11 libstreamanalyzer-dev libstrigiqtdbusclient-dev libxml2-dev libxslt1-dev shared-mime-info libgif-dev libpcre3-dev libssl-dev libbz2-dev libpcre3-dev libxml2-utils libpcre3-dev libopenexr-dev libjasper-dev libenchant-dev libavahi-common-dev libaspell-dev libasound2-dev libboost-dev libgpgme11-dev libldap2-dev libsasl2-dev libxine-dev libqimageblitz-dev libsmbclient-dev libxkbfile-dev libxcb1-dev libxklavier12-dev libxdamage-dev libxcomposite-dev libbluetooth-dev libusb-dev libcaptury-dev network-manager-dev libsmbclient-dev libsoprano-dev libsensors-dev libpam0g-dev libnm-util-dev libusb-dev libcfitsio3-dev libnova-dev libeigen-dev libopenbabel-dev libfacile-ocaml-dev libboost-python-dev libqca2-dev libqca2-dev libqca2-dev libsvn-dev libsvncpp-dev libcommoncpp2-dev subversion

If you want Akonadi support, you’ll need to install the MySQL Server.
sudo apt-get install mysql-server

Akonadi is a common cross-desktop storage backend for PIM data. It’s part of the kdesupport package, which contains  libraries that are not directly part of KDE but are required to support KDE.

2. Setup your .bashrc file
(more information here) so all the required environment variables are in place. You’ll find the .bashrc file in your home directory (~/.bashrc). Click here to look at the .bashrc file that I am using.

3. Compile Qt 4.4. To compile KDE from trunk, we’ll first need to compile the latest Qt 4.4 snapshot from source (assuming your distribution does not already have the latest Qt packages in the repos).

Create a directory called “kde” in your home folder :
cd ~
mkdir kde

Create another directory, “src” inside “kde” :
cd kde
mkdir src
cd src

Get the latest snapshot of Qt 4.4 from SVN :
svn checkout svn://anonsvn.kde.org/home/kde/trunk/qt-copy

Apply patches and build Qt :
cd qt-copy
./apply_patches
./configure -debug -prefix $QTDIR
make -j2
make install

You should now have a build of Qt 4.4 installed in your home directory.

4. Compile kdesupport. Next, we need to build the kdesupport package. Checkout the latest snapshot from trunk and build it.

cd ~/kde/src/
svn checkout svn://anonsvn.kde.org/home/kde/trunk/kdesupport
cd kdesupport
cmakekde

If it says it cannot find the cmakekde command, make sure your .bashrc is setup properly. If you haven’t logged out and logged in after setting up ./bashrc yet, make sure you do :
source ~/.bashrc

and then try again. Stay alert at this point and check if CLucene libs are found so that Soprano is built with CLucene support. This is important if you want Nepomuk to work. Do note that the libclucene packages in Gutsy are not compatible, so if you are on Gutsy, you’ll need to get the latest snapshot from here and compile it yourself. If kdesupport has already been built, you’ll need to rebuild it once libclucene is in place. Just go back into the kdesupport directory and do a “cmakekde”.

5. Compile kdelibs. Checkout kdelibs and build it.

cd ~/kde/src/
mkdir KDE
cd KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs

cd kdelibs
cmakekde

6. Build kdepimlibs. Checkout kdepimlibs and build it.

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs
cd kdepimlibs
cmakekde

7. Build kdebase. Checkout kdebase and compile it.

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase
cd kdebase
cmakekde

8. Compile other packages. Checkout and build all the other packages you need.

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeutils
cd kdeutils
cmakekde

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeadmin
cd kdeadmin
cmakekde

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdemultimedia
cd kdemultimedia
cmakekde

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdegraphics
cd kdegraphics
cmakekde

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeaccessibility
cd kdeaccessibility
cmakekde

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdegames
cd kdegames
cmakekde

cd ~/kde/src/KDE
svn checkout svn://anonsvn.kde.org/home/kde/trunk/KDE/kdenetwork
cd kdenetwork
cmakekde

For a complete list of available packages in SVN, look at http://websvn.kde.org/trunk/

9. Log into a KDE4 session. Create a file called kde4.desktop  in your /usr/share/xsessions/ folder so that your login manager picks it up. Let it have the following contents :

[Desktop Entry]
Exec=/home/YOUR_USERNAME/kde/bin/startkde
TryExec=/home/YOUR_USERNAME/kde/bin/startkde
Name=KDE4
Comment=This session logs you into KDE 4

Edit the Exec  and TryExec lines and replace YOUR_USERNAME with your username.

Log out. Select the KDE 4 session, log in and be greeted by a beautiful KDE desktop.

Dreamplace - Theme designed by Dmitry A (NattyWP)