Using -as-needed in KDE
Alexander S. Usov
A.S.Usov at kvi.nl
Sun Apr 10 15:07:38 PDT 2005
Recently I found somewhat strange patch to Mk/bsd.kde.mk :
Globally disable -Wl,-as-needed for all users of USE_KDELIBS_VER.
Binaries linked with -pthread and -Wl,as-needed will have all
references to libphthread stripped (reason/reasoning unknown),
causing funny runtime errors when Qt decides to fire up a thread.
Which I find somewhat strange, as I believe that there were reports
of a quite measurable increase in start-up time for KDE applications
due to the use of "-as-needed" linking flag.
As far as I can see there are at least two ways to work around the
issue described above.
The brute-force and dirty solution is to add something like
"-noas-needed -lptread -as-needed" to LDFLAGS.
In a more cleaner way, as it is libqt-mt who needs threading in the
first place, why not link it against libpthread? Additionally this
should solve the problems with qtk-qt-engine, which fails to load
now for non-threaded applications.
More information about the freebsd-ports