Back to KDE4 (also: "how to used a SVN-compiled KDE4 on Mandriva".)

If somebody on the interwebs read my rant titled "Back to KDE3" he'll know that I was very interested in running KDE4 but could because of the general slowness and innestability of Plasma. Well, it seems that now I'll be able to finally run it. Some things have changed that have made KDE run pretty fast finally.

  • I've upgraded(?)) my Mandriva 2009.0 to Cooker (currently known as Mandriva 2009.1Alfa). This is needed to have the latest versions of all the libraries that will be needed for compiling KDE. Also, and not less important, the new NVidia driver 180.16 which is probably the main cause Plasma goes pretty fast now.
  • I'm running KDE4 directly compiled from KDE's SVN (you can read another article where I explain how to do it here). For some reason even with the new NVidia driver Mandriva Cooker KDE4 packages crashed a lot and this is just not happening with the compiled KDE I'm running now (something must be botched on the packages). For this I'm using the excellent kdesvn-build program that makes the updating, compiling and installing of KDE from sources pretty easy if you have some Linux real experience (that is, you're not the average Ubuntu user or using their marketting terms, you're not a human being). Plus, if you've C++ programming experience having the source has the advantadge that you can fix the bugs you find or the features you want on you own and send a patch to the regular programmers of the component instead of whinning on bug reports on bugs.kde.org. The sources plus the compiled KDE result took 8GB on my disk, so check your disk space before doing this.

    If you're compiling KDE4 from source using kdesvnbuild yourself, there are some hints to help you in the process:

    • To have a working sound with Phonon and Gstreamer in your new KDE (and not only for KDE, algo for all Qt apps): Install every -dev gstreamer and xine packages from the distribution. Then edit $HOME/.kdesvn-buildrc file and enable (by uncommenting the qt-copy lines, if it was originally commented, which I don't remember) the compilation of qt-copy, even if you have Qt already installed from your distro packages and make sure the Qt part has the "-no-phonon" option enabled. Then enable (again, by uncommenting) the phonon part.
    • After the first compilation you should take a look at the place where you configured kdesvnbuild to download the sources, enter into the kdesvnbuild/log/latest directory and grep on every subdirectory (grep -r doesn't work, because the directories are symlinks) for "Could not find" because you'll see lot of optional libraries that are not being found. These are usually -devel packages that are already on Mandriva's repository and you just have to install them to enable these optional features (like, for example, pulseaudio sound). Once you've installed them, run kdesvn-build again to let it compile the packages with the new features enabled (since you've already compiled everything once, the second run should take a lot less time.)

    • Probably unrelated, but at the same time I upgraded to the compiled KDE, the flash plugin on both Firefox and Opera stopped working. Googling a little and testing random things, I came up to the solution: upgrade flash-plugin to the 10 version (I used the RPM from Adobe, first removing the Mandriva one) and remove the package libflashsupport, which is unneded with Flash 10 (and curiously was the ultimate culprit of flash not working with pulseaudio.) After this, I closed and opened both Opera and Firefox and flash had sound again.

    To integrate my self-build KDE into Mandriva I only had to take two steps:

    1. Modify my .bashrc to source a file containing this:
         prepend() { [ -d "$2" ] && eval $1=\"$2\$\{$1:+':'\$$1\}\" && export $1 ; }
      
         export QTDIR=$HOME/kde4/qt4
         prepend PATH $QTDIR/bin
         prepend LD_LIBRARY_PATH $QTDIR/lib
         prepend PKG_CONFIG_PATH $QTDIR/lib/pkgconfig
      
         # KDE
         export KDEDIR=$HOME/kde4
         export KDEHOME=$HOME/.kde4
         export KDETMP=/tmp/$USER-kde4
         mkdir -p $KDETMP
         export KDEDIRS=$KDEDIR
         prepend PATH $KDEDIR/bin
         prepend LD_LIBRARY_PATH $KDEDIR/lib
         prepend PKG_CONFIG_PATH $KDEDIR/lib/pkgconfig
         prepend QT_PLUGIN_PATH $KDEDIR/lib/kde4/plugins
      
         # XDG
         unset XDG_DATA_DIRS # to avoid seeing kde3 files from /usr
         unset XDG_CONFIG_DIRS
      
         # make the debug output prettier
         export KDE_COLOR_DEBUG=1
         export QTEST_COLORED=1
         
      I've called this file /home/juanjux/.kdesvn_env
    2. To integrate the new session into Mandriva's graphical login manager add a file called /usr/share/apps/kdm/sessions/09KDE4SVN.desktop with the content:
         [Desktop Entry]
         Encoding=UTF-8
         Name=KDE4SVN
         Comment=KDE4SVN
         TryExec=/home/juanjux/kde4/bin/startkde
         Exec=KDE4SVN
         Icon=
         Type=Application
         
      Using the desktop effect to overimpose the desktop performance in FPS while I stressed the windows manager changing desktops, calling the expose-alike effect and resizing windows, I found the combination of desktop options that works better for my system but I recommend everybody to do its own tests (it's not more than five minutes) to find the set of options that works better. You can change these options on systemsettings->Desktop->Advanced, and in my system (NVidia 8400GT) these were the best ones:
    • Compositing type: OpenGL. XRender works, but slower.
    • Keep window thumbnails: Only for shown windows. Probably the option "never" will be faster but I want the window thumbnails to be updated when I call the expose effect.
    • OpenGL mode: Shared memory. "Texture from pixmap" was slower and "Fallback" crashed everything.
    • Texture filter: Nearest (fastest)
    • Enable direct rendering: UNCHECKED. This is, with difference, the option that more positively impacted my desktop performance. Unchecking it my desktop went from about 50FPS on idle and 15-30 stressing it to 100FPS on idle and no less than 50 under stress.
    • Use VSync: CHECKED. Unchecking it crashed everything.

So I'm finally happy with my KDE 4 trunk; everything is stable, pretty and fast (the desktop effects are in fact faster than Compiz ones), my krunner (Alt+F2) finally has all the functionality of the KDE3 version (and much more), being equally fast. Oh, and Kate as an AWESOME Vi editting mode which combines the best of Vi mouseless editting with the best of GUI's (I'm writing this article on it.) I hope to give back some to the KDE guys fixing the bugs I find myself and maybe adding some functionality to the Vi mode of Kate.

tags: [ blog · articles · software libre · linux · kde ]
comments powered by Disqus