KDE from Trunk (4.4) + QT 4.6 on Kubuntu Karmic Beta

[IMPORTANT] Since this article is based on Karmic BETA, I’m gonna posting in the next few days a new article about how building KDE on Karmic stable ( I’m doing it now because my university duties are less strict in this period, so I can freshly install the whole OSย  ๐Ÿ˜› ) so consider this post as OUTDATED !

[Update-November 30, 2009] Since I had much free time to spend on KDE, I’ve added the new required packages needed to build KDE from trunk, such as the shared desktop ontologies, and addedย  some optional package and updated KDevelop and KdevPlatform location, in order to better enjoy your favourite DE ๐Ÿ™‚

[Update-November 09, 2009] Updated some dependencies ( thanks Tim ! ).

[Update-October 28, 2009] Improved Qt configure script, updated to SIP/PyQt4 4.6.1, added some libraries and Nepomuk Semantic Desktop available.

As I promised a week ago, today I’ll describe how to build KDE against the new Qt4.6, under Kubuntu Karmic Koala Beta1.


But, before starting, I give you a small advice: since I’m gonna to remove ALL the Qt and KDE libraries/binaries, if you are not comfortable with working on a pure command line shell, you should have a backup desktop environment different from KDE, for example Gnome or whatever you want. Moreover, some features are not yet fully ported, like the Python bindings for Qt ( as pointed out here ) and consequently KDE bindings; so, if you are planning to start developing KDE application with Python, you should not follow this guide. Finally, you need about 6 GB of free space to download and build all the sources required in your home directory, and about 1.3 GB in your /opt folder.

Step0 – Downloading source files =)

First of all, it’s common practice to create a folder used to download and unzip all the sources; so create it! The sources you need to retrieve and save in that folder are:

Then, unzip all these package. Now, if not already available, you have to install Git and Svn to retrieve the remaining sources =) So type in a terminal:

$ sudo apt-get install git-core subversion

Now we can proceed with downloading Qt sourcecode with the latest KDE patches. From the terminal, change directory where you started storing the sources for the whole environment, then type:

$ git clone git://gitorious.org/+kde-developers/qt/kde-qt.git

This will create a kde-qt directory containing all the code downloaded. Moreover, save this configuration file I made inside the kde-qt folder just created, and rename it as .sh instead of .doc. Then, download poppler ( needed to provide pdf rendering for Okular )

$ git clone git://git.freedesktop.org/git/poppler/poppler

If you plan to build Amarok ( I can’t figure KDE without Amarok btw ๐Ÿ˜› ), you probably want to enable integration with Last.Fm services, so you have to dowloand them by typing:

$ git clone git://gitorious.org/amarok/amarok.git

$ git clone git://github.com/mxcl/liblastfm.git

Step1 – Erasing every trace of old Qt and KDE libraries/binaries

Note: as I said before, now we will erase the traces of our old QT/KDE environment so the next steps will be performed within a pure tty console.

Well, from the shell, type:

$ sudo apt-get remove libqca2 libqimageblitz4 libsoprano4 libstreamanalyzer0 libstreams0 libstrigiqtdbusclient0 libqca1c2 qca-dev libqt* kdebase* kdelibs* kdepim* kde-icons-oxygen

Then, install all the required libraries ( and take a coffee in the meanwhile ๐Ÿ˜› ):

$ sudo apt-get install build-essential cdbs debhelper cmake libxml2-dev libxslt1-dev libbz2-dev shared-mime-info dbus-x11 libxkbfile-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxext-dev libjpeg62-dev libical-dev libpng12-dev subversion libsm-dev libxinerama-dev libtiff4-dev libxrender-dev libfontconfig1-dev libcurl4-openssl-dev libboost-dev libxcursor-dev doxygen libungif4-dev libdbus-1-dev libssl-dev libgpgme11-dev libasound2-dev kdesdk-scripts libpth-dev libjasper-dev ssh libglib2.0-dev libpcre3-dev diffstat libexpat-ocaml-dev libclucene-dev libclucene0ldbl libexiv2-dev quilt libspectre-dev xsltproc libxtst-dev libxdamage-dev libxcomposite-dev x-dev libfam0 libfam-dev libaspell-dev libenchant-dev libsmbclient-dev libopenexr-dev libraw1394-dev libpulse-dev libpci-dev libusb-dev network-manager-dev libgphoto2-2-dev mysql-server-core-5.1 mysql-admin libeet-dev gstreamer0.10-plugins-base sun-java6-jdk libcppunit-dev libgstreamer-plugins-base0.10-dev libmono-dev libssh2-1-dev libiw-dev libxss-dev libslp-dev lm-sensors bluez libbluetooth-dev libgps-dev libxklavier-dev libsasl2-dev acl flex bison libck-connector-dev libsensors-dev libxrandr-dev lzma-dev libssh-dev libxft-dev libpolkit-grant-dev libpolkit-dbus-dev libosip2-dev libeigen2-dev libdvdread-dev libmusicbrainz-dev libflac-dev libflac++-dev libsndfile-dev libsamplerate-dev libogg-dev libmpcdec-dev libmad0-dev libmp3lame-dev libavbin-dev libavcodec-dev libswscale-dev libcdparanoia-dev libmysqld-dev libtidy-dev libimlib2-dev libnl-dev libexempi-dev libv4l-dev libgcal-dev xscreensaver libcfitsio3-dev libindi-dev xplanet libsane-dev libxxf86vm1 libchm-dev libdjvulibre-dev libepub-dev libacl1-dev libvncserver-dev libortp-dev libspeex-dev libotr2-dev libmsn-dev libmediastreamer-dev libmeanwhile-dev libgadu-dev libassuan-dev libpilotobjects-dev libhunspell-dev libsvn-dev libarchive-dev libfftw3-dev libtheora0 libvorbisenc2 libxine-dev libxine-xvdr libmtp-dev libloudmouth1-dev libxine1-ffmpeg libgpod-nogtk-devย  libaudio-dev liblcms1-dev libmng-dev libsqlite0 libsqlite0-dev libgmp3-dev libxmu-dev

Now, reboot !

Step2 – Build/install Qt4.6. ( and something else ๐Ÿ˜› )

From the terminal shell, move in the kde-qt directory and type these commands:

$ git branch 4.6 origin/4.6-stable-patched

$ git checkout 4.6

$ export MAKEFLAGS=-j3

With these three commands, we simply have created a new local branch called 4.6 that points to a remote one called 4.6-stable-patched, and then we switched in this new branch. The last one is used to optimize compiling time with multicore cpu, and usually the number equals to #of_cores+1. To stay up-to-date, simply type in the terminal:

$ git pull –rebase

Now, it’s time to configure and build Qt4.6 . It’s quite simple, you have just to run the configure script you previously downloaded

$ sh ./kde-qt-configure1.sh

And, once correctly configured, simply type make and then sudo make install. Then, reboot.

Note: if you want to build the documentation, in order to browse it from your pc, type:

$ make docs

$ ./config.status

$ sudo make install

After that, let’s export some useful variables:

$ export QTDIR=/opt/qt4

$ export PATH=$QTDIR/bin:/usr/local/bin:$PATH

Now, we have to build and install:

  • QtScriptTools : this set of scripts are recommended in order to enable more features for kde apps, but it is required if you want to build Amarok. Assuming you dowloaded amarok sources and you just changed directory within the console, type:
    • $ cd supplementary_scripts/qtscriptgenerator/
    • $ sh sh build-qtscriptgenerator-git.sh
    • If that script fails on patching qtscript, simply open the file build-script generator.sh and replace _scriptdir=”$(dirname “$0″)” with _scriptdir=”..” and run it again
  • Desktop Ontologies :
    • $ cd your_shared_desktop_ontologies_directory
    • $ mkdir build && cd build
    • cmake .. && make && sudo make install
  • SIP :
    • $ cd your_sip_directory
    • $ python configure.py && make && sudo make install
  • PyQT:
    • $ cd your_PyQt_directory
    • $ python configure.py && make && sudo make install
  • Eigen2 :
    • $ cd your_eigen2_directory
    • $ mkdir build && cd build
    • cmake .. && make && sudo make install
    • $ cd your_xz_directory
    • $ mkdir build && cd build
    • ../configure && make && sudo make install
  • Poppler :
    • $ cd your_poppler_directory
    • mkdir build && cd build
    • cmake .. && make && sudo make install
  • Liblastfm :
    • $ ruby configure –release –prefix /usr/local && make && sudo make install
  • Soprano :
    • $ cd your_Soprano_directory
    • $ mkdir build && cd build
    • cmake .. && make && sudo make install
  • Raptor, Rasqal and Redland:
    • $ cd your_raptor_directory
    • $ ./configure && make && sudo make install
  • KDEsvn:
    • $ cd your_kdesvn_directory
    • $ chmod +x kdesvn-build
    • $ sudo cp kdesvn-build /usr/local/bin/kdesvn-build

Step3 – Downloading and Building KDE sources

Simply type:

$ sudo kdesvn-build –no-build

This wil take a long time to download all the sources files ( if you want to speed up your download/compilation time, you can disable some modules by modifying the file .kdesvn-buildrc ). Now, we have to tweak some cmake files in order to enable QCA. To do this, cd to your home directory, then type

$ sudo nano kde4/kdesupport/CMakeLists.txt

This will open a text editor within your shell. Now look for the line containing #macro_optional_add_subdirectory(qca) , uncomment it and save in order to enable building QCA. Then, if you want to build amarok, ASF and MP4 tag read/write for taglib must be enabled; so you need to type:

$ sudo nano kde4/kdesupport/taglib/CMakeLists.txt

then, we have to look for the lines

OPTION(WITH_ASF “Enable ASF tag reading/writing code”ย  OFF)
OPTION(WITH_MP4 “Enable MP4 tag reading/writing code”ย  OFF)

change the related values from OFF to ON and save the file ๐Ÿ™‚

Finally, type sudo kdesvn-build again and wait about 4 hours to get almost all the packages compiled and installed !

Step4 – Setting up kdm to point ur new environment

Open you favourite editor, create a file called kdestart.sh and type the following text:

export QTDIR=/opt/qt4
export KDEDIR=/opt/kde4
export KDEHOME=$HOME/.kde4
export PATH=$QTDIR/bin:$KDEDIR/bin:/usr/local/bin:$PATH

Save it, then

$ chmod +x kdestart.sh

$ sudo mv kdestart.sh /usr/local/bin/kdestart.sh

Open you favourite editor again, create a file called kde4.desktop and type the following text:

[Desktop Entry]

Save and then move it with the following command:

$ sudo cp kde4.desktop /opt/kde4/share/apps/kdm/sessions/kde4.desktop

Now, we have to tell to Upstart where to find kdm. So we need to modify an other file located in /etc/init/ called kdm.conf.

$ cd /etc/init/

$ sudo cp kdm.conf kdm.conf.bak

$sudo nano kdm.conf

We just made a backup copy of kdm.conf, and then opened the editor to modify kdm.conf. Now we have to find and replace the following lines:

  • PATH=/bin:/usr/bin:/sbin:/usr/sbin and replace with PATH=/opt/kde4/bin:/bin:/usr/bin:/sbin:/usr/sbin
  • DAEMON=/usr/bin/kdm and replace with DAEMON=/opt/kde4/bin/kdm

And what about Amarok ?

Compiling Amarok is quite simple:

$ cd your_amarok_dir

$ mkdir build && cd build

$cmake -DCMAKE_INSTALL_PREFIX=/opt/kde4 .. && make && sudo make install

That’s all !

The End!

Now simply type sudo start kdm or better, reboot your pc to enjoy your new KDE ๐Ÿ˜€

By the way, feedbacks and comments are appreciated in order to improve and fix this guide ๐Ÿ˜‰

C ya =)

5 responses to “KDE from Trunk (4.4) + QT 4.6 on Kubuntu Karmic Beta

  1. Hey there, thanks for the guide! I’m still only halfway through, but wanted to comment that libssh2-1-dev is available for installation in Karmic final, not libssh2-dev.
    I’ll be back to comment later about how things went. Again, thank you for being so thorough in documenting this build process!


  2. OpenVG would be a compelling reason for me to switch
    Would this build instructions enable OpenVG by default on Mesa7.6 or 7.7 (Assuming Gallium and OpenVG had been built too of course)


    • Well, in these instructions the OpenVG support is not enabled; by the way it’s pretty easy to do that, simply add the -openvg flag in the kde-qt-configure script ( with your previous assumptions of course ๐Ÿ˜‰ ).
      By the way, tell me whether the compiling process successes or not, so I can modify my guide accordingly =)


  3. Pingback: KDE SC 4.4Beta2 from trunk on Ubuntu Karmic « [Po]lentino's blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s