Date: Thu, 15 Feb 2001 22:06:23 +0200 From: Maxim Sobolev <sobomax@FreeBSD.org> To: Daniel Eischen <eischen@vigrid.com> Cc: freebsd-current@FreeBSD.org, ports@FreeBSD.org Subject: Re: -lc_r against shared library (Re: Failed to build kdesupport2 port) Message-ID: <3A8C36BF.592D2B16@FreeBSD.org> References: <Pine.SUN.3.91.1010215134302.15890A-100000@pcnet1.pcnet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen wrote:
> [ CC list trimmed ]
>
> On Thu, 15 Feb 2001, Maxim Sobolev wrote:
> > You have totally misunderstood the purpose of my patch. The patch *isn't* intended as a quick fix for the recent -lc_r/-pthread weirdness, but instead it would provide
> > porting team with infrastructure necessary to start converting existing ports to the new world order. In a nutshell, -pthread should be replaced with ${PTHREAD_LIBS} and
> > -D_THREAD_SAFE with ${PTHREAD_CFLAGS} in all Makefiles from the ports collection. In addition all places where -pthread hardcoded in patches should also be identified and
> > adjusted to respect ${PTHREAD_LIBS} and ${PTHREAD_CFLAGS}.
>
> I support the addition of PTHREAD_CFLAGS/PTHREAD_LIBS to bsd.port.mk. It
> allows one to specify exactly which threads library they want to use
> (build against), even linuxthreads I would think.
>
> If it matters, I think we've decided to keep the -pthread linker
> option until FreeBSD gets its own libpthread at which point -pthread
> will be deprecated. So there's no urgent rush to convert ports
> to use the new mechanism if it's adopted.
You are not quite right (unfortunately). The current behaviour or -pthread breaks lots of ports because by default gcc doesn't link shared modules with -lc_r even with this
flag, thus requiring that you to explicitly specify -pthread or -lc_r when linking program with shared library that uses pthreads. Good example of such breakage is libGL from
XFree86-4. This library requires pthreads, but most programs that use this library don't use threads and as such have no idea why they need -pthread to link with libGL.
Therefore we have several choices:
1. Fix bazillion GL ports and ports with similar breakage by explicitly adding -pthread into each one (poor choice IMO);
2. Make -pthread flag link shared modules with -lc_r (jdp is against this for not very clear to me reasons);
3. Use -lc_r instead of -pthread in all threaded ports, which is equivalent to 2, BTW, but jdp have no control over this.
-Maxim
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A8C36BF.592D2B16>
