PATH for plugin loaded via KDE plugin library

1.2k views Asked by At

I am debugging a plugin that is loaded by the ( IIRC) KDEPluginLoader class.

The problem is that whenever I have made modifications to the plugin, they are not seen.

This is because the application is loading the plugin from the "system plugin area". I do not want to put this plugin in that area. ( and really I shouldn't have to.) But lsof points to the plugin in the system area.

How do I get the application to load plugins from the compile directory first?

1

There are 1 answers

2
dhaumann On

Default Plugin Folders

Next to the global paths, e.g.

/usr/share/kde4/services/*.desktop
/usr/lib64/kde4/*.so

the local paths are also scanned, i.e.

~/.kde4/share/kde4/services/*.desktop
~/.kde4/lib64/kde4/*.so

The first time you copy a library into one of these paths, you have to launch kbuildsycoca4 (which stands for: K Build SYstem COnfiguration CAche). This cache is used by KDE's plugin system to quickly search for services (plugins).

Note, that the information in the .desktop file must point to the correct library filename. For instance, /usr/share/kde4/services/ktexteditor_hlselection.desktop says:

X-KDE-Library=ktexteditor_hlselection

So KDE's plugin architecture will look for:

/usr/lib64/kde4/ktexteditor_hlselection.so
~/.kde4/lib64/kde4/ktexteditor_hlselection.so

The one in the home folder has higher priority.

Custom Plugin Folders

You can tell KDE to look into more folders for the services (.desktop files) and libraries (*.so files). This requires you to set several environment folders, e.g.:

export LD_LIBRARY_PATH=/home/me/folder/lib:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/path/to/share

The latter will then search in: /path/to/share/kde4/services/ for *.desktop files.

Make sure you run kbuildsycoca4 with the environment variables set. Then start your application from a shell where your environment variables are set.

I have not tested this, so these instructions especially with respect to XDG_DATA_DIRS may not work out of the box. But it should bring you a lot closer to your goal.

Update: You don't need a desktop file and XDG_DATA_DIRS if you already have a respective .desktop file in one of the services folders. So setting LD_LIBRARY_PATH in this case should do the trick.