Dealing with linking issues under KDE 4.1
The Debian KDE 4.1 packages are built with the KDE4_ENABLE_EXPERIMENTAL_LIB_EXPORT option, which alters how CMake (the build system used by KDE) links to the KDE libraries. Linking to a library no longer implies linking to all of its dependencies, so a target must now explicitly link to every library it uses. While this behaviour is to become standard for KDE 4.2, KDE 4 software that relies on the previous linking behaviour may fail to build.
If you want, you can find more information on this thread on kde-buildsystem maillist.
If you need to compile a KDE 4 application :
1- Use Debian patched packages
Use the Debian source package if possible, since they are known to work. You can find the available package in these pages : official KDE modules and extra applications.
You can get the source with apt-get source and compile it if needed.
Note: CMake options can be set with the variable DEB_CMAKE_EXTRA_FLAGS in debian/rules
2- Automatic fix
Use the autofixtll script to automatically find most linking problems and generate a patch to fix them.
- Download the script from our SVN
- From the root of your unpacked source, run:
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON
$ cd ..
$ autofixtll -i -c make -d build -q none - If autofixtll doesn't do the trick, you can finish with the manual way below.
- For more help on using autofixtll, just read autofixtll --help.
3-Manually find and repair linking problems :
- We assume cmake runs well, and that make fails with this kind of message :
CMakeFiles/kcm_krunner_spellcheck.dir/spellcheck_config.o:(.data.rel.ro._ZTV13ConfigFactory[vtable for ConfigFactory]+0x44): undefined reference to `KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&)'
[...]
collect2: ld returned 1 exit status
make[2]: *** [lib/kcm_krunner_spellcheck.so] Error 1
make[1]: *** [runners/spellchecker/CMakeFiles/kcm_krunner_spellcheck.dir/all] Error 2
make: *** [all] Error 2
xavier@kawet:~/tmp/compile/svn/plasma/build$ - locate the unresolved function (here KPluginFactory::create)
- locate the failing build target (here kcm_krunner_spellcheck in directory runners/spellchecker)
- find the library providing it : the best way to do this is to search api.kde.org. Googling KPluginFactory site:api.kde.org/4.1-api, you can see it's in kdecore. For Qt modules, you can search in doc.trolltech.com/4.4.
- edit the relevant CMakeLists.txt file and locate the target_link_libraries line corresponding to the build target and add the relevant ${KDE4_*_LIBS} or ${QT_*_library} tag. Here is a list of the available ones :
- KDE4_KDECORE_LIBS
- KDE4_KDEUI_LIBS
- KDE4_KIO_LIBS
- KDE4_KPARTS_LIBS
- KDE4_KUTILS_LIBS
- KDE4_KDE3SUPPORT_LIBS
- KDE4_KFILE_LIBS
- KDE4_KHTML_LIBS
- KDE4_KJS_LIBS
- KDE4_KJSAPI_LIBS
- KDE4_KNEWSTUFF2_LIBS
- KDE4_KDNSSD_LIBS
- KDE4_KDESU_LIBS
- KDE4_KPTY_LIBS
- KDE4_PHONON_LIBS
- KDE4_THREADWEAVER_LIBRARIES
- KDE4_SOLID_LIBS
- KDE4_KNOTIFYCONFIG_LIBS
- KDE4_KROSSCORE_LIBS
- KDE4_KROSSUI_LIBS
- KDE4_KTEXTEDITOR_LIBS
- KDE4_KNEPOMUK_LIBS
- KDE4_KMETADATA_LIBS
- PLASMA_LIBS
- KDE4_AKONADI_LIBS
- KDE4_AKONADI_KMIME_LIBS
- KDE4_GPGMEPP_LIBS
- KDE4_KABC_LIBS
- KDE4_KBLOG_LIBS
- KDE4_KCAL_LIBS
- KDE4_KIMAP_LIBS
- KDE4_KLDAP_LIBS
- KDE4_KMIME_LIBS
- KDE4_KPIMIDENTITIES_LIBS
- KDE4_KPIMUTILS_LIBS
- KDE4_KRESOURCES_LIBS
- KDE4_KTNEF_LIBS
- KDE4_KXMLRPCCLIENT_LIBS
- KDE4_MAILTRANSPORT_LIBS
- KDE4_QGPGME_LIBS
- KDE4_SYNDICATION_LIBS
- QT_QT3SUPPORT_LIBRARY
- QT_QTASSISTANT_LIBRARY
- QT_QTCORE_LIBRARY
- QT_QTDBUS_LIBRARY
- QT_QTDESIGNER_LIBRARY
- QT_QTDESIGNERCOMPONENTS_LIBRARY
- QT_QTGUI_LIBRARY
- QT_QTMOTIF_LIBRARY
- QT_QTNETWORK_LIBRARY
- QT_QTNSPLUGIN_LIBRARY
- QT_QTOPENGL_LIBRARY
- QT_QTSQL_LIBRARY
- QT_QTXML_LIBRARY
- QT_QTSVG_LIBRARY
- QT_QTSCRIPT_LIBRARY
- QT_QTTEST_LIBRARY
- QT_QTMAIN_LIBRARY
- QT_QTUITOOLS_LIBRARY
- QT_QTASSISTANTCLIENT_LIBRARY
- QT_QTHELP_LIBRARY
- QT_QTWEBKIT_LIBRARY
- QT_QTXMLPATTERNS_LIBRARY
- QT_PHONON_LIBRARY
- For the example in runners/spellchecker/CMakeLists.txt, replace
target_link_libraries(krunner_spellcheckrunner ${KDE4_KDEUI_LIBS} ${PLASMA_LIBS})
with
target_link_libraries(krunner_spellcheckrunner ${KDE4_KDEUI_LIBS} ${PLASMA_LIBS} ${KDE4_KDECORE_LIBS})
- run cmake and make once more until you have fixed it all :)
Note : sometimes, the symbol is provided by a library from the software you are trying to compile. Try searching in build/lib/*