Previous Entry Share Next Entry
Compiling a KDE plasma applet
I spent a lot of time compiling a hacked version of KDE’s binary clock. I’ll try to describe the process here in case it helps somebody out there.

The initial problem’s that the documentation isn’t coherent. There are pages on scripting, voluminous pages on the niceties of accessing the repositories, the repositories themselves that have all the source code but no instructions on compiling it, and instructions on building this or that without links to the source code. There’s also a tendency to provide simple instructions with no hints as to what to do when it goes wrong.

I ended up following this:

I made a src folder inside my project folder and did this in it:

git clone git://

Then I went down two folders an dran the kde-devel-env script that was recommended. I’m not sure it worked.

I ran the cmake and that failed, which was already not promising.

Then I tried to get the source dependencies. First there was a problem with me not having a source repository set, so I added it in synaptic. Then I ran this stuff:

% sudo apt-get update
% dpkg-query -S plasma-applet-binaryclock.desktop
plasma-widgets-addons: /usr/share/kde4/services/plasma-applet-binaryclock.desktop
% sudo apt-get build-dep plasma-widgets-addons
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Picking ‘kdeplasma-addons’ as source package instead of ‘plasma-widgets-addons’
E: Ignore unavailable version ‘4:4.8.4-1’ of package ‘plasma-widgets-addons’
E: Unable to find a source package for kdeplasma-addons

It’s a shame this didn’t work. I spent the rest of the weekend building this package.

So, the next step was to go into the folder for my applet and try to build it directly. That went reasonably well. I fixed some things in the source because it didn’t seem to have been intended to be built like this.

This was important:

find_package(KDE4 REQUIRED)

and I did a sudo apt-get install kde-workspace-dev
that seemed to help, so at this point I could run cmake successfully.

At this point, I found a package called kdesrc-build that does everything automatically. I reckoned that the modules weren’t intended to be built independently and I should let this do all the work.

% sudo apt-get install kdesrc-build
% kdersc-build-setup
% kdesrc-build

That worked for 6 of the 18 packages I selected.

So I decided to pull the changes I’d made from the folder I made them to the source folder this script had created, and try to build from there. I went back to building in the applet’s folder. I discovered it couldn’t find some include files that I could find, so I started adding them to flags.make (one of the files with warnings in telling you not to edit it). This included adding the path to a file cmake had created because cmake didn’t appear to know about it when it wrote the file I was editing. I also changed an include file in the source code, and managed to get the applet to compile but not link.

The problem seemed to be that the applet was compiled against plasmaclock but as I hadn’t compiled that I didn’t have the library files it needed. Then I went back to the kdesrc-build script because plasmaclock is in the kde-workspace package, and that had failed to build, and probably had dependencies that only kdesrc-build was going to sort out.

I resolved one dependency after another as cmake presented them to me in its log files. I’ll try to record all the packages I installed:

libsm-dev libglib2.0-dev libpolkit-qt-1-dev libpolkit-agent-1-dev libxml2-dev libxml2-dev libgstreamer-plugins-base0.10-dev libvlc-dev libbz2-dev libdbus-1-dev libdbusmenu-qt-dev libxslt1-dev libgif-dev libpng12-dev libjpeg8-dev kdepimlibs5-dev libqimageblitz-dev libx11-xcb-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-shm0-dev libxcb-sync0-dev libxcb-image0-dev libxcb-render-util0-dev libxcb-keysyms1-dev libxkbfile-dev libxcomposite-dev libxdamage-dev libxrender-dev libxrandr-dev libxcursor-dev libraw1394-dev libpci-dev libxi-dev libboost1.49-all-dev libxtst-dev

Along the way, kdesrc-build made the startling observation that “There is probably a local error causing this kind of consistent failure, it is recommended to verify no issues on the system.”

Anyway, after all this, I managed to get a clean build. Not all features are eanbled, because they depend on libraries that couldn’t be found, but that doesn’t really matter because I only want a clock. And I do have a .so file. I’ll work out what to do with it another day.

Oh, yes, and along the way I noted that the 48 KB of source files I was trying to compile required 316 KB of generated configuration files. That’s not configuration files for the kdeplasma-addons package but configuration files for this applet. There’s something deeply wrong with this system.


Log in