SyCoCa - Fixing broken KDE apps

Ian Wadham iandw.au at gmail.com
Sat Sep 15 21:33:44 PDT 2012


Hi guys,

KDE has several apps that are useful on a Mac desktop: Amarok music player,
Digikam photo editor and manager, KMyMoney4 financial package and several
good games.  However people have sometimes trouble installing and running
them from Macports.  I think I may have stumbled upon one of the answers.

A few days ago I installed Macports kdesdk4 @4.8.3_0 port (KDE System
Development Kit).  I wanted to use KDE's Kompare utility, which displays a
side-by-side colour-highlighted picture of diffs between two text files - very
handy for some code maintenance work I am doing at present.

At first Kompare could not be run from the Mac's Applications folder.  It just showed
a popup message saying that it could not find its "view part".  So I tried running

  /Applications/Macports/KDE4/kompare.app/Contents/MacOS/kompare

from the command line.  The output suggested I run "kbuildsycoca4".  This
sounded like a good idea.  It has often been suggested on KDE developers'
lists over the years, as a fix for various build and installation problems.  The
"which" command showed that Macports had installed it, so I ran it and bingo,
Kompare started to work.

A day or so later, acting on a hunch, I decided to try the Palapeli jigsaw-puzzle
game in the kdegames4 port.  This has never worked properly for me on the Mac.
I could do the demo puzzles that come with the game, but I could not use the
"slicer" facility to create my own puzzles from my own photos, with more challenging
numbers of pieces.  This also was now suddenly working.  Brilliant!

So I set out to try and find out what KSyCoCa really is and what kbuildsycoca4
really does.  That was not easy.  Some of the top hits on Google were:

    https://trac.macports.org/ticket/25578 - Amarok does not run
    https://trac.macports.org/ticket/34919 - kmymoney4-devel does not run on Lion 10.7.4
    http://mac-os-forge.2317878.n4.nabble.com/How-to-introduce-a-call-to-kbuildsycoca4-in-a-kde-port-td153618.html

The last one shows some Macports guys scratching their heads over it.  The
other top hits did not tell me anything much.  One Windows group were even
wondering if "kbuildsycoca4.exe" was some kind of malware … :-)

The KDE technical pages http://techbase.kde.org/ gave me a rough answer,
but AFAICS they are not indexed on Google.  Have a look here:

    http://techbase.kde.org/Development/Tutorials/Services/Introduction
        under the heading "SyCoCa: The System Configuration Cache"

Basically, there are several KDE applications that call on plugins, KParts or
other applications to do part of their work.  Those other bits and pieces have
.desktop files as part of their installation, but to avoid having to search 100s
of .desktop files at execution time KDE keeps a cache, called SyCoCa.

If this cache is broken or out of date, parts of a multi-part KDE application could
fail to run - as in the Kompare and Palapeli apps above.  More info on how this
stuff works is in three KDE tutorials.  Links to them are shown at:

    http://techbase.kde.org/Development/Tutorials#Services:_Applications_and_Plugins

Now I would like to make some suggestions to Macports developers:

    a. Add a note to those that appear after KDE-related installations, saying to try
        running kbuildsycoca4 if any KDE application fails to run.

    b. Automate the running of kbuildsycoca4 after every KDE-related installation.

        I would suggest "kbuildsycoca4 --noincremental" after installing or activating
        kdelibs4, i.e. a rebuild the whole cache, and "kbuildsycoca4" after all other
        KDE-related installations or activations, i.e. update the cache.

I think b. would keep the cache nice and clean at all times and would be harmless,
even if it was overkill on some occasions.

I am not a core KDE developer, so I would also suggest that Macports developers
contact kde-devel <kde-devel at kde.org> or kde-core-devel <kde-core-devel at kde.org>
for information from people who know more about how KDE and KDE apps work.

All the best, Ian W.
KDE Games Development Team



More information about the macports-users mailing list