CMake Questions

Michael Nottebrock lofi at freebsd.org
Mon Mar 20 19:15:39 GMT 2006


On Monday, 20. March 2006 19:52, Szombathelyi Gy�rgy wrote:
> 2006. március 20. 18.17 dátummal Thiago Macieira ezt írta:
> > Alexander Neundorf wrote:
> > >On Sunday 19 March 2006 20:54, Szombathelyi György wrote:
> > >> What I still found missing from cmake, is the support for the
> > >> --as-needed and --enable-new-dtags linker flag. (--enable-new-ldflags
> > >> with autoconf/automake).
> > >
> > >Ok, if we need these flags we can add them. What do these flags do ?
> >
> > --as-needed:
> >   Instructs the linker to check which libraries symbols it imports are
> > from. This means that if I link my program:
> >
> > #include <QtCore/QCoreApplication>
> > int main(int argc, char **argv)
> > {
> >   QCoreApplication app(argc,argv);
> >   return 0;
> > }
> >
> > with the libraries: -lQtCore -lQtGui -lkdecore -lkdeui -lkio
> >
> > the linker will realise that my program only imports symbols
> > from "libQtCore.so.4", so it'll add the DT_NEEDED entry for
> > libQtCore.so.4 only.
> >
> > With --no-as-needed (the default), the compiler would produce:
> >   NEEDED libQtCore.so.4
> >   NEEDED libQtGui.so.4
> >   NEEDED libkdecore.so.5
> >   NEEDED libkdeui.so.5
> >   NEEDED libkio.so.5
> >
> > And those libraries would be loaded at run-time, with their
> > initialisation routines performed (think static variables constructed
> > with function calls or static objects).
> >
> > Needless to say it's expensive and unnecessary. However, it doesn't come
> > without its own share of side-effects. When we tried to make it the
> > default in KDE, we ended up with problems when trying to run uninstalled
> > binaries. The reason for that is that the library search path for
> > indirect libraries (libraries-required-by-libraries but not your program)
> > would be different and you'd end up loading the wrong ones.

And on FreeBSD (where only binaries get linked to threads libraries, but not 
other shared libraries), the linker would not flag the threads libs as needed 
dependencies, thus breaking everything.

Cheers,
-- 
   ,_,   | Michael Nottebrock               | lofi at freebsd.org
 (/^ ^\) | FreeBSD - The Power to Serve     | http://www.freebsd.org
   \u/   | K Desktop Environment on FreeBSD | http://freebsd.kde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060320/3a40193d/attachment.sig>


More information about the kde-core-devel mailing list