Getting Started/Build/Coexisting Versions
Question: Is it possible to build and run two versions of KDE on the same computer?
Answer: Sure, in fact, this document was written to help you out.
[edit] The Basics
Why would someone want to have more than one copy of KDE installed? Well, the most probable case is that the user is a developer or translator working on KDE. He or she likely needs a copy of the SVN to work on. However, in order to browse the web, check email, and perform other common tasks, the user may also want a copy of a stable version of KDE.
Using two versions of KDE is not terribly difficult, as long as each version is kept separate. What exactly does this mean?
- Each KDE version should be installed to a different target. This means setting a different KDEDIR environment variable before compiling.
- When building a KDE program, it should be able to see the correct version of the KDE libraries only.
- Newer versions of KDE have a tendency to make configuration files unusable for older versions. You can use the KDEHOME variable to change the default ~/.kde to ~/.kdesvn or similar. Alternatively, you can simply use only one version of KDE per user.
[edit] An Example - KDE 3.0.1 and SVN
While I've chosen to use KDE 3.0.1 and the SVN as an example installation, this method of installation is not meant to be version specific. I've chosen these versions as KDE 3.0.1 is the latest stable release at the time of this writing and this setup should be fairly typical.
I wanted to make it simple for someone following these instructions to keep environment variables and configuration files between different versions of KDE separate. In this light, these instructions use two different users: a normal user and a SVN development user, 'kde-devel'. Those wanting to run KDE using only one user are encouraged to write a shell script to set the necessary environment variables and are wished best of luck.
Go to your favorite ftp mirror and fetch KDE 3.0.1. This should include arts, kdelibs, kdebase, and any other tarballs you would like. Also, download a copy of the source code for Qt 3.0.4.
As your normal user, edit your login script (.profile, .login, .bash_profile or similar) to include a QTDIR, KDEDIR, PATH, and LD_LIBRARY_PATH which point to the installation target for KDE 3.0.1. An excerpt of the file could look like the following (for bash):
QTDIR=/usr/local/qt-stable KDEDIR=/usr/local/kde-stable KDEHOME=/home/example/.kde-stable PATH=$PATH:$QTDIR/bin:$KDEDIR/bin LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib XDG_DATA_DIRS=$KDEDIR/share/:/usr/local/share/:/usr/share/ XDG_CONFIG_DIRS=$KDEDIR/etc/xdg/:/etc/xdg/ export QTDIR KDEDIR PATH LD_LIBRARY_PATH XDG_DATA_DIRS XDG_CONFIG_DIRS
Note: we are not using /etc/ld.so.conf for KDE or Qt as this is a system wide configuration file. LD_LIBRARY_PATH allows us set this instead on a per-user basis.
Log out and log back in as your normal user. Check that the new variables are set correctly. Make sure that $PATH, $LD_LIBRARY_PATH, $XDG_DATA_DIRS and $XDG_CONFIG_DIRS contain the paths to no other versions of KDE and Qt.
echo $QTDIR echo $KDEDIR echo $KDEHOME echo $PATH echo $LD_LIBRARY_PATH echo $XDG_DATA_DIRS echo $XDG_CONFIG_DIRS
Compile Qt:
bunzip2 qt-x11-3.0.4.tar.bz2 tar xvf qt-x11-3.0.4.tar mkdir $QTDIR mv qt-x11-3.0.4/* $QTDIR cd $QTDIR ./configure -system-zlib -qt-gif -system-libpng \ -system-libjpeg -plugin-imgfmt-mng -thread -no-stl \ -no-xinerama -no-g++-exceptions make
Compile and install each of the tarballs for KDE 3.0.1. The
configure script should automatically pick up on KDEDIR and adjust
your prefix. Using ./configure --prefix=$KDEDIR is fine, too.
cd [package name] ./configure make su make install logout
Create the user kde-devel:
useradd kde-devel passwd kde-devel
Log in as 'kde-devel' and get a copy of the SVN.
In the login file for 'kde-devel' put something like the following:
QTDIR=/home/kde-devel/qt-unstable KDEDIR=/home/kde-devel/kde-unstable KDEHOME=/home/kde-devel/.kde-unstable PATH=$PATH:$QTDIR/bin:$KDEDIR/bin LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib XDG_DATA_DIRS=$KDEDIR/share/:/usr/local/share/:/usr/share/ XDG_CONFIG_DIRS=$KDEDIR/etc/xdg/:/etc/xdg/ export QTDIR KDEDIR PATH LD_LIBRARY_PATH XDG_DATA_DIRS XDG_CONFIG_DIRS
Log out and log back in as 'kde-devel' again. If you want to use su, make sure to use 'su - kde-devel' instead of 'su kde-devel'. By using a hyphen, su will create a clean environment and load the login scripts as if an actual login took place.
Now would be a good time to check PATH and LD_LIBRARY_PATH for 'kde-devel'.
echo $PATH echo $LD_LIBRARY_PATH
Compile and install each package of the KDE SVN.
cd [package name] ln -s ../kde-common/admin make -f Makefile.cvs ./configure make make install logout
Edit your ~/.xinitrc file to say 'startkde'. Try it out!
startx
[edit] Running a KDE 3.0.1 program while using KDE SVN.
Often its useful to run a program with a different version from the version of KDE your currently using. Using the networking features of the X server makes this fairly easy. Here's how: From X, bring up a terminal (konsole is good). Tell the X server to accept connections.
xhost [username]@ # or if that doesn't work and you don't care about security: xhost +
Switch users:
su - [username]
Set the DISPLAY environment variable:
export DISPLAY="localhost:0.0"
Run any X (and therefore KDE) program that you want. Note, that by appending a ampersand, you may run multiple programs concurrently.
xcalc & kwrite & konqueror &