Saturday, April 17, 2010

Quick Compiling Kate in a stable KDE Environment

Since all of the Kate code is now co-hosted on gitorious, it became very easy to build Kate in your stable KDE >= 4.4 environment. This means you can run the newest version of Kate with very few effort. Just give it a try and do the following steps:
  1. make sure you have the following packages installed: git, cmake and kdelibs development package (on openSUSE this is git, cmake and libkde4-devel)
  2. create and change into a KDE development directory:
    mkdir ~/kde; cd ~/kde
  3. get a copy of the Kate code:
    git clone git://
  4. create and change into a build directory for compilation:
    mkdir build; cd build
  5. run the configure process with cmake:
    cmake ../kate -DCMAKE_BUILD_TYPE=fulldebug \
  6. compile Kate:
  7. finally install Kate:
    make install
That's all! This installs Kate locally into the separate directory ~/kde/usr, so that your global KDE installation will not be touched at all.

Now on to starting the newly compiled Kate. Create a file ~/kde/ with the following content:
export KATE_DIR=~/kde/usr

export PATH=$KATE_DIR/bin:$PATH
# update KDE's system configuration cache
# start app
Now you can run the compiled Kate version with ~/kde/ kate. Just calling kate directly will start the system version of Kate.

Your copy of Kate contains all of the Kate code, i.e.: the KTextEditor interfaces, Kate Part, KWrite and the Kate Application. Feel free to send patches to our mailing list And join #kate on :-)

Note for KDE developers: All the changes in git are merged back to KDE's subversion repository in a timely manner. So don't worry about Kate moving away from KDE; this is not the case.

(Updated on 2010-04-17: Allow installation into local directory.)


eMerzh said...

On my ArchLinux i have a CMake Error at app/CMakeLists.txt:33 (kde4_add_library):
Unknown CMake command "kde4_add_library".

I there a howto "How to Compile Kate for testing purpose" ( and not for installing) ?

Thanks for your help

Unknown said...

This is because you're trying to run cmake at the kate/app CMakeLists.txt, but you must do it in the one which is at the root directory.

zak89 said...

Cool! I just got my fresh new Kate running! One quick question - I now have no (0) plugins - no Filesystem Browser, to Tab bar, nothing. Where do I find these now?

dhaumann said...

@eMerzh: When you call cmake ../kate, the directory ../kate must be equal to kde/kate. Maybe yours is kde/kate/app?

You can install it locally by creating a new user and then install it into your `kde4-config --localprefix` directory. This way you surely won't touch your working user account.

@zak89: Mh, try to run kbuildsycoca4 to update KDE's system configuration cache. Does that help?

zak89 said...

Hmm... Running kbuildsycoca4 dosen't seem to make a difference.

I should note that i uninstalled the system version of Kate before installing the git version. Is that a problem?

dhaumann said...

No, should not be a problem. I'll provide a solution later or tomorrow.

Unknown said...

@zak89: you probably need to set KDEDIRS properly, so the plugins are found correclty.

If Kate also installs XDG_DATA stuff (I think some icons?), you'll have to setup XDG_DATA_DIR and XDG_CONFIG_DIR (or was it _DIRS) appropriately as well.

Take a look at how I do it at:

zak89 said...

Thanks guys, it seems to be working now - strangely a reboot seemed to fix the issue.

BTW, recently someone on the planet posted a patch for a new Tab bar plugin - does anyone know who/where this came from? Now that I have Kate installed from source I'd like to try it out.

vivo said...

for gentoo users something like this should work


where gentoo_common_config.cmake contains:
SET (LIB_SUFFIX 64 CACHE STRING "library path suffix" FORCE)
SET (CMAKE_INSTALL_LIBDIR lib64 CACHE PATH "Output directory for libraries")

and gentoo_rules.cmake
SET (CMAKE_C_COMPILER /usr/bin/x86_64-pc-linux-gnu-gcc CACHE FILEPATH "C compiler" FORCE)
SET (CMAKE_CXX_COMPILER /usr/bin/x86_64-pc-linux-gnu-g++ CACHE FILEPATH "C++ compiler" FORCE)

better, do it yourself, start an emerge of kate, stop it with ^C after it did ran cmake and analize ;)

vivo said...

now I've another problem:
lsof | grep " $(pidof kate) " | grep '/usr/lib64/kde4/'
show that a bunch of .so used are still from system kde.
LD_PRELOAD does not help, what to do?

dhaumann said...

Can you try with the current suggestion of the script?

Unknown said...

KATE_DIR is set up with /usr at the end. This makes PATH, LD_LIBRARY_PATH and KDEDIR have a ~kde/usr/usr portion which does not work.

dhaumann said...

Travis: Thanks, fixed.

Anonymous said...

This post is now for the twelfth time on planetkde. Can you please make sure it does not show up there again?

dhaumann said...

@toma: How? I'm simply fixing typos or other bugs in the howto, and click publish... How can I tell to not update the index again?

Akregator does not show it again, btw.

chandra said...

On Kubuntu Lucid with packages from kubuntu:ppa I had problems with the Spellchecker swalloing up adjacent words.

So I installed git-core cmake and kdelibs5-dev.

I then followed the instructions to install kate from git to the letter, and voila! I had a flawless kate experience. Spellcheck works perfectly now.

Thank you Dominik Haupmann.