CMake Questions
Szombathelyi Gy�rgy
gyurco at freemail.hu
Mon Mar 20 18:52:42 GMT 2006
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.
>
Also it's very convenient for packaging, since the last little package will
not depend on millions of other packages, just because the 10th indirect
dependency pulls them. And the last gain: e.g your qt compiled with libpng10,
and your program linked with it, you can freely upgrade your libpng and qt
without touching the application!
____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol
Probald ki most! http://www.freestart.hu
More information about the kde-core-devel
mailing list