Using -as-needed in KDE

Michael Nottebrock michaelnottebrock at gmx.net
Sun Apr 10 15:43:44 PDT 2005


On Monday, 11. April 2005 00:06, Alexander S. Usov wrote:
> Hi!
>
> Recently I found somewhat strange patch to Mk/bsd.kde.mk :
>
> Revision 1.47
> 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.

Exaggerated.

> 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.

No, that doesn't work.

> In a more cleaner way, as it is libqt-mt who needs threading in the
> first place, why not link it against libpthread?

Because we don't do that in FreeBSD, see below.

> Additionally this 
> should solve the problems with qtk-qt-engine, which fails to load
> now for non-threaded applications.

And it would cause other problems elsewhere, which is why the decision was 
made during the development of 5-CURRENT to globally go with -pthread and 
resolve pthread symbols not through libraries but through executables only.

You can work around the problems with gtk-qt-engine by running the affected 
programs with something like env LD_PRELOAD=/usr/lib/libpthread.so.1 
<program>.

-- 
   ,_,   | 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: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20050411/237c85e9/attachment.bin


More information about the freebsd-ports mailing list