CMake and dependencies

Andreas Pakulat apaku at
Fri Jul 30 12:37:09 CEST 2010

On 30.07.10 11:45:41, Michael Jansen wrote:
> > No it shouldn't unless akregatorinterfaces explicitly lists khtml in its
> > LINK_INTERFACE_LIBRARIES (see man cmake, target_link_libraries). And
> > that should only happen if akregratorinterfaces uses symbols from khtml
> > in its public API. If its all inside the .cpp file then there's no
> > reason to declare khtml as interface-library.
> > 
> > If akregatorstorageexporter uses symbols from khtml it needs to
> > explicitly link against the library (unless another of the libs it links
> > against has it in the interface-libs).
> > 
> > Also this interface-libs stuff only works with cmake targets (real ones
> > or imported ones properly set up), so if thats not the case you also
> > have to link khtml explicitly.
> I have the following problem with all of this:
> I have two installations of
> 1. The Qt Version
> 2. The git/master Version
> When linkink the akregatorexport target ld decides by itself to link against khtml. i have no idea 
> why and i know of no option to find out about the reason.

IIRC 'older' ld versions do this, they link your app against the whole
world. (Just linking a hello-world qt app will pull in X11 png etc into
your apps linking). There are flags to turn this off and AFAIK more recent
versions of ld have these enabled by default. 
> Then ld notices that khtml uses libphonon and links against that too. That's where things get 
> interesting. It finds libphonon from qt. Again i have no idea how it decides to use that version. I 
> googled and failed to find a explanation.

Is that Qt in /usr/lib? That would be a reason for ld to find it over one
that is installed elsewhere.

> There is only one lib in my system that require that libphonon version (rpath).

rpath (and runtimepath) embedded into the binaries are AFAIK only used
during runtime, not during link-time. Link-Time paths are given by using
the -L flag for ld.

> The build stops because it misses ONE symbol that was added in the git/master Version recently. And 
> it says it misses it from libkhtml.
> Under the idea that Akregatorinterfaces does not expose KHTML on it's interface. Everything here 
> works correct according to your description.
> But it doesn't link anyway.
> And i hope the answer is not you have to remote the Qt libphonon. I have a similar problem with 
> poppler. The poppler build itself picks up ab a libpoppler from my system.

If those libs are in /usr/lib, then yes the solution is to remove them, or
rather move them to a location that is not included in the ld-call for
akregator (look for the -L flags).

> And how is all of that supposed to work with gold? Which according to common mythology does not add 
> anything not specified on the command line to the linking process.

Unless I'm mistaken gold wouldn't try to auto-link in libphonon in the
first place (unless the akregator library uses symbols from it). Thats why
there are these 'link with gold' commits in KDE-land that most of the time
add additional libraries to the target_link_libraries call.

All of the above "AFAIK" and "according to my experience", I didn't study
ld behaviour in depth...


You work very hard.  Don't try to think as well.

More information about the Kde-buildsystem mailing list