Bug 160976 - Too much linkage ...
Summary: Too much linkage ...
Status: RESOLVED LATER
Alias: None
Product: buildsystem
Classification: Developer tools
Component: KDE4 (cmake) (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Neundorf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-18 15:35 UTC by Sune Vuorela
Modified: 2008-04-27 17:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Vuorela 2008-04-18 15:35:31 UTC
Version:            (using Devel)
Installed from:    Compiled sources
Compiler:          gcc - debian unstable 
OS:                Linux

Hi!

When I am building kde, there is in general added too much stuff to the linker line.

Looking at building kode for example (a tiny app in kdepim). I could have chosen almost any application in almost any module and seen same behaviour.
-lQtSvg -lQtCore -lpthread -lkdecore -lSM -lICE -lX11 -lXext -lXft -lXau -lXdmcp -lQtGui -lQtXml -lXtst -lXcursor -lXfixes -lXrender -lkdeui -lkode -lkresources -lkldap -lkde3support -lkabc -lQtCore -lpthread -lkdecore -lkdeui -lQtSvg -lSM -lICE -lX11 -lXext -lXft -lXau -lXdmcp -lXtst -lXcursor -lXfixes -lz -lstreamanalyzer -lstreams -lQtCore -lpthread -lkdecore -lsolid -lQtGui -lfam -lXrender -lkio -lldap -llber -lsasl2 -lQtCore -lpthread -lQtNetwork -lQtDBus -lQtXml -lz -lbz2 -lresolv -lkdecore

Or let me try to remove the doubles:
-lQtSvg 
-lQtCore 
-lpthread 
-lkdecore 
-lSM 
-lICE 
-lX11 
-lXext 
-lXft 
-lXau 
-lXdmcp 
-lQtGui 
-lQtXml 
-lXtst 
-lXcursor 
-lXfixes 
-lXrender 
-lkdeui 
-lkode 
-lkresources 
-lkldap 
-lkde3support 
-lkabc 
-lpthread 
-lkdeui
-lz
-lstreamanalyzer
-lstreams
-lsolid
-lfam
-lkio
-llber
-lsasl2
-lQtNetwork
-lQtDBus
-lQtXml
-lbz2
-lresolv
-lkdecore

And then us then look at some of the code.

No includes from any of the X libs. No includes from fam. no includes for bz2, no for zlib and only around half of the kdelibs are actually used. 
And the used libraries aren't actually exposing the libraries to link against.

The only thing this helps for is increasing the required count of installed packages - and increased start up time. And making it harder for binary distributions to make packages.

I don't know wether it is the used FindFoo.cmake files that are broken, all the cmakelist.txt files or cmake itself - but I have the impression that all are a bit at fault.

/Sune
Comment 1 Alexander Neundorf 2008-04-21 22:00:26 UTC
This is at least partly the same as this one:
http://public.kitware.com/Bug/view.php?id=6846
so please add further comments on that aspect over there please.

Why does it increase the number of required packages ? The libs should really only appear there if they are used (at least by some base library), so they really should be required. 

But I can have a look whether there are some unnecessary duplictes.

Alex
Comment 2 Modestas Vainius 2008-04-21 23:29:39 UTC
I wrote a patch (for CMake 2.6) which:

* Makes use of the new IMPORTED targets to import kdelibs library dependency information (instead of old _LIB_DEPENDS)
* Makes use of LINK_INTERFACE_LIBRARIES [1] target property to minimise the number of libraries exported via public interface to the ones absolutely necessary.
* Compatible with CMake 2.4, simply the old way is used. However, if KDELibs was built with CMake 2.6, CMake 2.4 cannot be used to build other KDE apps.

Patches are available at http://svn.debian.org/wsvn/pkg-kde/branches/kde4/packages/kdelibs/debian/patches/?rev=0&sc=0 (97th and 98th)

Checkout http://svn.debian.org/wsvn/pkg-kde/branches/kde4/packages/kdelibs/debian/changelog?op=file&rev=0&sc=0 for a bit more details.

Currently we are in progress to recompile whole KDE with them to discover deficiencies.

1. http://www.vtk.org/Bug/view.php?id=3490
Comment 3 Modestas Vainius 2008-04-27 15:04:31 UTC
Alex, do you support my work or do you think I'm pushing too far with all this?

In the end, it will hurt Debian users because some KDE apps will fail to compile out-of-the-box (without fixed target_link_libraries). Some KDE apps (including offcial module) assume recursive and implicit dependences of ${ZLIB_LIBRARY} ${X11_X11_LIB} etc, but this is not a very big problem. However, if I drop implicit ${QT_QTDBUS_LIBRARY} ${QT_QTXML_LIBRARY} (which are not strictly needed for every app and lib), things get very ugly (with many linkages failing).
Comment 4 Alexander Neundorf 2008-04-27 17:07:31 UTC
Completely independent from whether you are right or not, DON'T DO THAT.

There is not yet any stable 2.6.0 release, you shouldn't make anything depend on the RCs.
KDE4 requires cmake 2.4.5, you make it require cmake >= 2.6.0.
We just had one user on the kdevelop list claiming that KDE requires cmake 2.6, and it surely doesn't.
By modifying it so much from the original sources in svn, we end up with two very different builds, and we/I can't support builds which differ from KDE svn.

Once we require cmake 2.6.x for KDE, we can and probably will do that.

So if you want to modify anything in the KDE build, please discuss it before on kde-buildsystem@kde.org.

I strongly suggest that you use cmake 2.4.5 or 2.4.8 for building KDE for the packages.

Alex