Getting Started/Build/KDE4.x
Getting_Started/Build/KDE4.x
Languages: عربي | Asturianu | Català | Česky | Kaszëbsczi | Dansk | Deutsch | English | Esperanto | Español | Eesti | فارسی | Suomi | Français | Galego | Italiano | 日本語 | 한국어 | Norwegian | Polski | Português Brasileiro | Română | Русский | Svenska | Slovenčina | Slovenščina | српски | Türkçe | Tiếng Việt | Українська | 简体中文 | 繁體中文
Tutorial Series | Getting Started |
Previous | None |
What's Next | n/a |
Further Reading | Compilation FAQ |
NOTE
This section is a bit out of date although, IIUC, some users are still running KDE-3.5.x.
This page will not have further updates but will remain available for those that are converting from KDE-3 to KDE-4.
If you are upgrading your KDE-4 to a version >= KDE-4.4.0 or to the KDE-4.4 SVN BRANCH, see the new page:
which is currently under construction.
Objectives
You first need to decide if you want to keep your current KDE-3 installation till you feel that KDE-4 (or a new KDE-4.x.y version) meets your needs for actual day to day use of your computer. Yet, you will be able to change over with a minimum of work when the time comes to make the switch. Even if you plan to immediately switch over to KDE-4 (or a new KDE-4.x.y), I still recommend that you use the method I describe since it will take some time to build all of KDE-4 as a background job even on a fast system and you will probably want to continue to use your system until the build and install is finished.
Method
The best way to accomplish this is to install the needed support libraries on your system in the usual manner. Convention is that these should be installed in the /usr/local/ or /usr directory. By default, Troll Tech installs Qt in: /usr/local/Trolltech/Qt-4/. It is best to install KDE-4.x.y (along with KDE specific libraries) in its own directory so that the directory can be deleted if some major problem occurs -- also useful if you are building from SVN as it is a good idea to make a fresh install occasionally since building from SVN only adds things; obsolete things are not removed. I will be using /opt/KDE-4/ but you can call it whatever you want.
Remember to add the: "lib" directories:
- /usr/local/Trolltech/Qt-4/lib
- /opt/KDE-4/lib
(or the directories you are using if different) to your: "/etc/ld.so.conf" file. These new libraries have different names so there should be no conflicts.
If you are currently running KDE-3, we can keep configurations straight by using a separate user account for accessing KDE-4 (until you switch over to KDE-4). This user account will contain your configurations of KDE-4 and will have a script to set the environment variables (.bash_profile if using Linux). When you want to changeover to KDE-4, all that is needed is to change the configuration information. If you are installing multiple versions, you probably want to substitute: "KDE-4.<x>" (where <x> is the minor release number; e.g. KDE-4.4) for: "KDE-4" in these instructions.
Installation
Required packages from your distribution
- Linux from Scratch or to build from source.
(Till other distro instructions are added, you can probably determine the correct dependencies to install by reading the LFS list of libraries)
You might also find some of this useful:
Create the User Account
Use whatever method you wish to create a new user account. For example: "KDE4". If you install multiple KDE-4 versions, you will need a user account for each one (e.g. "KDE43", "KDE44") and install each version in a separate directory (e.g. "/usr/4.3", "/opt/KDE-4.4") . Then edit or create the user specific login script (.bash_profile for Linux). There is a lot that goes into this. Note that this presumes that USER was correctly set by the system login script.
------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
- XDG_DATA_HOME="$HOME/.local/share"
- XDG_CONFIG_HOME="$HOME/.config"
- export XDG_DATA_HOME XDG_CONFIG_HOME
- KDEDIR=/opt/KDE-4
- KDEHOME=$HOME/.kde4
- KDETMP=/tmp/$USER-kde4
- mkdir -p $KDETMP
- KDEVARTMP=/var/tmp/$USER-kde4
- mkdir -p $KDEVARTMP
- KDEDIRS=$KDEDIR
- PKG_CONFIG_PATH=$KDEDIR/lib/pkgconfig:$PKG_CONFIG_PATH
- export KDEDIR KDEHOME KDETMP KDEVARTMP KDEDIRS PKG_CONFIG_PATH
- QTDIR=/usr/local/Trolltech/Qt-<version>
- QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins
- PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH
- export QTDIR QT_PLUGIN_PATH PKG_CONFIG_PATH
- PATH=$QTDIR/bin:$KDEDIR/bin:$PATH
- export PATH
- MANPATH=$MANPATH:"$KDEDIR/share/man"
- export MANPATH
- XDG_CONFIG_DIRS=$KDEDIR/etc/xdg
- XDG_DATA_DIRS=$KDEDIR/share
- export XDG_CONFIG_DIRS XDG_DATA_DIRS
- LD_LIBRARY_PATH=$QTDIR/lib:$KDEDIR/lib
- export LD_LIBRARY_PATH
------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
Be sure to get the paths correct for your system!!! And, replace <version> with your Qt version.
This is in addition to other things that you need in the script which would probably go at the beginning -- this large block of junk is to be added at the end. The XDG directories might need to be modified for your system. It is not normally necessary to set XDG_DATA_HOME and XDG_CONFIG_HOME to their default values however, this is included here to override other possible settings on your system.
If you want access to data in another account, you need to add the new account (KDE4) to the private group of that other account. If you still have access issues, check the directory permissions. The private group for the other user must have the needed permissions.
CMake
KDE-4 and some of the supporting libraries use CMake instead of the autotools "configure" script. CMake normally uses a separate build directory. So follow these steps:
- mkdir build
- cd build
- cmake .. <configure parameters>
- make
- make install
Don't forget the ".." after cmake!
If CMake has problems finding things it may help to append
- -DCMAKE_PREFIX_PATH=$KDEDIR
as CMake configure parameter.
Downloading with SVN
Checkout
Read the tutorial if you are not familiar with SVN.
You will probably find it convienent to keep your SVN checkouts organized. You can create directories:
- /usr/SVN/branches
- /usr/SVN/tags
- /usr/SVN/trunk
and then organize the sub-directories the same as the SVN repository tree is organized.
To see which modules exist for a KDE-4.x branch go to:
- http://websvn.kde.org/branches/KDE/<version>
To checkout a branch module, use the command:
- svn co svn://anonsvn.kde.org/home/kde/branches/KDE/<version>/<module_name>
{e.g. where <version> is 4.3 or 4.4 etc.}
Example
To get started with KDE-4.4 need to open a Konsole and:
- mkdir -p /usr/SVN/branches/KDE/4.4
- cd /usr/SVN/branches/KDE/4.4
- svn co svn://anonsvn.kde.org/home/kde/branches/KDE/4.4/kdelibs
- svn co svn://anonsvn.kde.org/home/kde/branches/KDE/4.4/kdepimlibs
- svn co svn://anonsvn.kde.org/home/kde/branches/KDE/4.4/kdebase
This is the minimum required to build. After you install this, you can checkout the other modules that you want.
D-Bus Configuration
For this to work, you must properly configure D-Bus.
See the D-Bus Configuration Tutorial
Build
To build, you must be logged on as the new user account (e.g. KDE4). I suggest that you use a Virtual Terminal [VT] rather than trying to do this in a Konsole because it appears that opening a Konsole as root does not give you the same environment as executing "su" in a VT. You can 'su' for the whole thing or 'su -c' for each install.
Packages need to be installed with the correct prefixes for this to work
If you are building Qt from source, the default prefix is:
- /usr/local/Trolltech/Qt-<version>
If you installed it from a binary, determine the prefix and change: QTDIR in the script above.
Building KDE should use these <configure parameters>:
- -DCMAKE_INSTALL_PREFIX=/opt/KDE-4
- -DSYSCONF_INSTALL_DIR=/etc/kde-4
- -DCMAKE_BUILD_TYPE:STRING=Release
And, for KDE-4.4, and later, you must build with this CMake parameter:
- -DKDE4_AUTH_POLICY_FILES_INSTALL_DIR:STRING=/usr/share/PolicyKit/policy
when running cmake.
KDESupport (and other related packages if building them separately) should installed (before you build the KDE packages), with the same CMAKE_INSTALL_PREFIX and SYSCONF_INSTALL_DIR as you will use for KDE.
- Other (non-KDE) packages should be installed with the default prefix (/usr/local) or in /usr -- whichever you prefer.
After installing the dependencies, you need to build:
- KDELibs
- KDEPIMLibs
- KDEBase
in that order.
KDELibs should not be built with:
- KDE4_AUTH_BACKEND_NAME:STRING=POLKITQT-1
KDEGraphics needs to be installed before you build KDEBindings.
Starting
You will have two "startkde" scripts on your system and you will probably need to make changes so that you use the correct one to start the version that you want. Specifically, the KDE 'desktop' file for KDM for your current KDE probably has the full path to the "startkde" script so the different PATH will not make any difference. Change it to:
- Exec=startkde
- TryExec=startkde
Switching to KDE-4
First, the simple part. If you have a:
- /etc/profile.d
directory as Linux should, you need to add these two files:
qt4.sh ------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
# Qt-4 initialization script (sh) QTDIR=/usr/local/Trolltech/Qt-<version> QT_PLUGIN_PATH=$KDEDIR/lib/kde4/plugins PKG_CONFIG_PATH=$QTDIR/lib/pkgconfig:$PKG_CONFIG_PATH export QTDIR QT_PLUGIN_PATH PKG_CONFIG_PATH PATH=$QTDIR/bin:$PATH export PATH
------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
Replace <version> with your Qt version.
Note: this presumes that the KDE-4 script (below) is run first which will set KDEDIR.
Note regarding QTDIR: This environment variable is not needed to run Qt-4 applications, but it is needed to build packages against a Qt library. If you are using only one version of Qt on your system, there is no issue. Otherwise, you need to remember to see that it is set it to the appropriate path before you build something against a Qt library.
kde-4.sh ------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
# KDE-4 initialization script (sh) KDEX="kde4" KDEDIR="/opt/KDE-4" KDEHOME=$HOME/.kde4 PATH="$KDEDIR/bin:$PATH" KDEDIRS=$KDEDIR:/usr export KDEDIR KDEHOME PATH KDEDIRS if test -n "$MANPATH" ; then MANPATH=$MANPATH:"$KDEDIR/share/man" else MANPATH="$KDEDIR/share/man" fi export MANPATH KDETMP=/tmp/$USER-$KDEX mkdir -p $KDETMP KDEVARTMP=/var/tmp/$USER-$KDEX mkdir -p $KDEVARTMP export KDETMP KDEVARTMP KDE4_XDG_CONFIG_DIRS=/opt/KDE-4/etc/xdg KDE4_XDG_DATA_DIRS=$KDEDIR/share if test -n "$XDG_CONFIG_DIRS" ; then XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS:$KDE4_XDG_CONFIG_DIRS else XDG_CONFIG_DIRS=$KDE4_XDG_CONFIG_DIRS fi if test -n "$XDG_DATA_DIRS" ; then XDG_DATA_DIRS=$XDG_DATA_DIRS:$KDE4_XDG_DATA_DIRS else XDG_DATA_DIRS=$KDE4_XDG_DATA_DIRS fi export XDG_DATA_DIRS XDG_CONFIG_DIRS
------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
If you don't have the: "profile.d" directory, you need to add this stuff to your "/etc/profile" script.
This eliminates the need for the large block of stuff in your: ".bash_profile" script.
Now, if you remove KDE-3, and reboot your system, all should be OK -- but it probably won't. Or, perhaps you don't want to remove KDE-3.
The: "profile.d" scripts are executed in alphabetical order, so you can modify the order by adding capitol letters to the beginning of the file names. For Example, you can name your KDE-4 script: "ACkde-4" to have it executed in the desired order.
What is important for this to work is for the PATH to be set correctly so that the directory: "/opt/KDE-4/bin" is before the: "bin" directory for KDE-3.
I have KDE-3 installed in: "/usr/kde-3" so I have a: "profile.d" script for it. This made disabling KDE-3 very simple. I just disabled that script. Note that you don't want to disable Qt-3 because you might have applications which use it.
However, if you have KDE-3 installed in: "/usr" you may have issues disabling it.
One major issue, if you leave KDE-3 installed and can not disable it is the menu. You probably don't want the KDE-3 stuff in your menu while running KDE-4. The KDE-3 menu 'desktop' files are in:
- <kde-3 prefix>/share/applications/kde
so you can remove them from the menu by locking that directory -- set the permissions to 000.
Getting Help
I note that this tutorial is intended for those that have some experience building from source. I have not included sufficient details for newbies because I feel that you should probably not attempt building KDE-4 as your first build from source project.
If you need help, please join the "kde" or "kde-linux" mailing list.