This document was originally written around September 2001 and originally published on Userlocal.com.
It is archived here in its original form (except that I've applied a bit of HTML formatting) and won't be updated.


Installing KDE 2.2 from source on Slackware Linux 8.0 (quick guide)

I've had my eye on KDE 2.2 ever since it's release, but unfortunately binary packages for Slackware 8 are not currently available, so the only option would be to build and install from source. After thinking about it for a few days (it is a major download after all) I desided to go ahead with it instead of waiting for Slackware packages to be provided by someone else. I also desided to write this short guide for the bennefit of other people wanting to this as well.

I want to point out from the start that this is no in-depth explanation of all the various compilation options and switches that can be applied to this proccess, it is merely a description of the procedure I used to get it running on my box. If you are a very inexperienced with building programs from source or are affraid of messing up your existing (nicely configured) system, then I suggest you wait for binary, pre-build packages to become available. You should also know that during the cause of this document I deliberately remove my previous version of KDE and all it's settings to start with a completely clean slate, so if you do not want to do that then don't follow these instructions.
And remember: Always have an up-to-date backup of any existing files before doing a major update such as this one - you have been warned!

I also assume a few things about you, dear reader. I assume that you are familiar with the Slackware Linux package tools to remove and install packages, I assume you know basic UNIX/Linux commands such as 'cp' and 'rm' and that you are comfortable working from a console (as opposed to X), and I also assume that you are comfortable editing system configuration files and such.
This is not a difficult procedure, but I don't explain basic tasks in detail. I suggest you read through the entire text at least once before you begin to ensure that you are capable of handling the tasks I present.

Are you still here? Good, then let's get started.

Before we begin I'd like to tell you a few things: I assume that you already have a copy of all the KDE 2.2 source packages(in bzip2 format) downloaded to a directory called KDE2.2 that is located in your homedir (~/KDE2.2/).
There are a few other files that you will need in addition to the KDE sources (as KDE 2.2 depends on them and they don't come with a default Slackware install) - the files you need in addition to KDE are these (I've listed download locations for your convenience):
libxml2-2.4.3.tar.gz
 ftp://ftp.gnome.org/pub/GNOME/stable/sources/libxml/libxml2-2.4.3.tar.gz
pcre-3.5.tar.bz2
 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-3.5.tar.bz2
audiofile-0.2.2.tar.gz
 ftp://oss.sgi.com/projects/audiofile/download/audiofile-0.2.2.tar.gz
SDL-1.2.2.tar.gz
 http://www.libsdl.org/release/SDL-1.2.2.tar.gz

Not all of the above are strictly nessesary, but as I've said previously, this is a description of how I did it, and you will have to deside for your self whether or not you want to install them (they all provide nice extra features and I strongly recommend you install them - I'll go through the nessesary steps later). KDE 2.2 also depends on a few other libraries such as 'libssl' and 'qt' but for these (and other dependencies) Slackware 8 already comes with the required versions (make sure you have the OpenSSL, Lesstif and QT libraries from your Slackware CD installed as well as htdig - having the oggutils package installed is also be a good idea if you want support for the Ogg Vorbis sound format in KDE).

The first thing we want to do is to remove the version of KDE that came with Slackware 8 (KDE 2.1.1). When you do this you should _NOT_ be running KDE at the same time and I'd strongly recommend that you don't run X at all during this procedure. Drop to a normal console and do all the work from there.

The easiest way to remove KDE is by using either 'pkgtool' or 'removepkg'. The packages you want to remove are (you'll need to be root to remove packages): kadmin, kdebase, kdegames, kdelibs, kdepim, kdesdk, kdetoys, kdeutils,
kdevelop, kdoc, kgraphic, kmedia, knetwork, koffice, ksupport,
kdi-ca, kdi-cs, kdi-da, kdi-de, kdi-el, kdi-eo, kdi-es, kdi-et,
kdi-fi, kdi-fr, kdi-he, kdi-hu, kdi-is, kdi-it, kdi-ja, kdi-ko, kdi-lt,
kdi-nl, kdi-no, kdi-nony, kdi-pl, kdi-pt, kdi-ptbr, kdi-ro, kdi-ru, kdi-sk,
kdi-sl, kdi-sr, kdi-sv, kdi-tr, kdi-uk, kdi-zhcn, kdi-zhtw

You probably don't have all these packages installed (especially not all the language 'kdi-*' packages), but remove the ones from the list that you do have.
You should also notice that I remove koffice but I don't reinstall it later, that's simply becourse it is not a part of the official KDE 2.2 distribution. If you need koffice then I suggest you get the latest version from http://www.koffice.org/ and follow the installation instructions on that site, or you could try reinstalling koffice from your Slackware 8 CD after you've got KDE 2.2 running - it might work, but I haven't tried that.

Now KDE 2.1.1 is almost out of the way, we just need to remove all the personal configuration files that it drops in your homedir.
Log in to the console as your normal user and delete the files '.kderc' and '.kxmlrpcd'. The '.kde' dir will also have to go as well as the 'Desktop' dir (warning: this erases any KDE configurations you've made). You should actually be able to keep the 'Desktop' directory, but to make things as smooth as possible I removed everything.

Now, we'll install the various extra libraries that KDE 2.2 "require". These are, as I've said before, not strictly required, but if you enjoy things like sound-support, good regular expression support in JavaScript and the ability to use the XML based help system, then you'll be glad you installed them. I assume you install the libraries and if you run into trouble later go back and install these and try again.
For the four packages libxml2-2.4.3.tar.gz, pcre-3.5.tar.bz2, audiofile-0.2.2.tar.gz & SDL-1.2.2.tar.gz installation is simply a matter of uncompressing the files (use 'tar zxf' for .gz files and 'tar yxf' for .bz2 files) and then as a normal user running the command

./configure && make

in the newly created directory. Followed by

make install

as the root user.

I'll give you one example, the others are identical:

jesper@sleipner:~/KDE2.2$ tar zxf audiofile-0.2.2.tar.gz
jesper@sleipner:~/KDE2.2$ cd audiofile-0.2.2
jesper@sleipner:~/KDE2.2/audiofile-0.2.2$ ./configure && make
...
...at this point a lot of configuration and compilation info will scroll by...
...
jesper@sleipner:~/KDE2.2/audiofile-0.2.2$ su
Password:
root@sleipner:/home/jesper/KDE2.2/audiofile-0.2.2# make install
...
...at this point a lot of installation info will scroll by...
...
root@sleipner:/home/jesper/KDE2.2/audiofile-0.2.2# exit

If you follow this procedure for the four libraries and don't encounter any errors then they should now all be installed in /usr/local/lib. Make sure that the /usr/local/lib directory is present in the file /etc/ld.so.conf - when you've added it or verified it's existence, then run the command 'ldconfig' as root. Running 'ldconfig' will update your systems database of shared library locations so that the newly installed libs can be found by other applications (KDE in our case).
You should also verify that the KDEDIR environment variable is set from /etc/profile and that it is set in your current environment. A line like this should be in /etc/profile :

export KDEDIR=/opt/kde

also run that command from the commandline while loged in as your normal user.

Now we get to the interresting part; installing KDE 2.2 itself. Actually this part is no more interresting than the previous one, it is in fact a lot duller since the steps required for every single package are virtually identical, I just felt that an air of enthusiasm should be present at this point ;)

The KDE packages can be installed in almost any order, but there are a few rules you must obey. Since many packages depend on other packages, a few of them must be installed in a specific order. According to the official KDE instructions the kdelibs package must be the first one installed, then packages can be installed in arbitrary order, but the kdeaddons package must be the very last one installed. At least according to the KDE installation instructions. I found while building the packages that there are apparently a few other dependencies on package installation order, so I recommend the following installation order for the least amount of trouble:
kdelibs
kdebase
kdoc
kdeutils
kdeadmin
kdenetwork
kdeartwork
kdegraphics
kdepim
kdegames
kdetoys
kdemultimedia
kde-i18n-da (or a different language package depending on your choice)
kdebindings
kdesdk
kdevelop

The procedure for installing each package is very similar, they all consist of running ./configure with a few parameters followed by make and then make install as root in the directory created when you extract the source package with 'tar yxf'. Since you should have no problems if you follow the package order given above, I'll just list the various configure options I used for each package - I'll give a full example for the first one (kdelibs) though.
I encourage you to run './configure --help' in each of the package directories to see if there are options you would set differently from me - If you are in doubt go with what I've used, that should work for you as well.

Before you actually start compiling you should know one more thing; all kde libraries go in /opt/kde/lib, so that line must also be present in the /etc/ld.so.conf file, and every time a package installs a library you must run ldconfig as root before proceeding - I recommend that you just run ldconfig after you have run 'make install' for every package since it will do no harm if no libraries were installed, but it is strictly nessesary if libs were installed.

kdelibs (full example):
~/KDE2.2 $ tar yxf kdelibs-2.2.tar.bz2
~/KDE2.2 $ cd kdelibs-2.2
~/KDE2.2/kdelibs-2.2 $ ./configure --prefix=/opt/kde --with-distribution
~/KDE2.2/kdelibs-2.2 $ make
~/KDE2.2/kdelibs-2.2 $ su
~/KDE2.2/kdelibs-2.2 # make install
~/KDE2.2/kdelibs-2.2 # ldconfig
~/KDE2.2/kdelibs-2.2 # exit
~/KDE2.2/kdelibs-2.2 $ cd ..
~/KDE2.2 $

kdebase (just configure line):
./configure --prefix=/opt/kde --with-x --with-shadow

kdoc (just configure line):
./configure --prefix=/opt/kde

kdeutils (just configure line):
./configure --prefix=/opt/kde

kdeadmin (just configure line):
./configure --prefix=/opt/kde

kdenetwork (just configure line):
./configure --prefix=/opt/kde

kdeartwork (just configure line):
./configure --prefix=/opt/kde

kdegraphics (just configure line):
./configure --prefix=/opt/kde

kdepim (just configure line):
./configure --prefix=/opt/kde

kdegames (just configure line):
./configure --prefix=/opt/kde

kdetoys (just configure line):
./configure --prefix=/opt/kde

kdemultimedia (just configure line):
./configure --prefix=/opt/kde --with-x --enable-gtk --with-tcltk --enable-motif --enable-slang --enable-ncurses

note: if the above configure line gives you problems becourse you don't have gtk, tcl/tk, motif (or lesstif), slang or ncurses installed, then just delete the config.cache file and re-run ./configure without the --enable option for the toolkit you are missing.
kde-i18n-da (just configure line):
./configure --prefix=/opt/kde

kdebindings (just configure line):
./configure --prefix=/opt/kde

note: if you have the Java development kit from Sun Microsystems installed and want to use the Java bindings, you might need to add --with-java=/path/to/your/jdk-dir to the configure line.
kdesdk (just configure line):
./configure --prefix=/opt/kde

kdevelop (just configure line):
./configure --prefix=/opt/kde

Most people will probably not need the kdebindings, kdesdk and kdevelop packages, as the contain things mostly used by software developers. The kdebindings package contains KDE bindings to different programming languages, so if you need a KDE program written in a different language than C++ you may need that package even if you don't plan to do any software development yourself.

If everything has gone well up to this point you should actually be able to run the new KDE, but it will not start by default when you type startx, and KDE will not be an option in xwmconfig. This is easily fixed, just grab the file xinitrc.kde from your kdebase.tgz package from the Slackware 8 CD-ROM and copy it to your harddrive, then you'll be able to use xwmconfig as usually to select KDE as your default desktop.
The xinitrc.kde file is located in the kdebase.tgz package in the following dir: etc/X11/xinit/ and should be copied to the same location on your harddrive. You can use a program like 'mc' to browse the content of a .tgz package and extract just a single file - you can also use tar directly like this:
( cd / ; tar zxf /cdrom/slakware/kde1/kdebase.tgz etc/X11/xinit/xinitrc.kde )

That should be it, you should now be able to run KDE2.2 - enjoy!

I hope you have found this document usefull. Any comments you might have are very welcome :-)