From owner-freebsd-current Thu Feb 15 12: 6:43 2001 Delivered-To: freebsd-current@freebsd.org Received: from blizzard.sabbo.net (smtp.sabbo.net [193.193.218.18]) by hub.freebsd.org (Postfix) with ESMTP id 07C2637B401; Thu, 15 Feb 2001 12:06:31 -0800 (PST) Received: from vic.sabbo.net (root@vic.sabbo.net [193.193.218.112]) by blizzard.sabbo.net (8.10.1/8.10.1) with ESMTP id f1FK6Pn07894; Thu, 15 Feb 2001 22:06:26 +0200 Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vic.sabbo.net (8.11.2/8.11.2) with ESMTP id f1FK6Um20606; Thu, 15 Feb 2001 22:06:30 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3A8C36BF.592D2B16@FreeBSD.org> Date: Thu, 15 Feb 2001 22:06:23 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: uk,ru,en MIME-Version: 1.0 To: Daniel Eischen Cc: freebsd-current@FreeBSD.org, ports@FreeBSD.org Subject: Re: -lc_r against shared library (Re: Failed to build kdesupport2 port) References: Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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