From owner-freebsd-stable Thu Dec 19 17:48:17 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0ED937B401 for ; Thu, 19 Dec 2002 17:48:16 -0800 (PST) Received: from drugs.dv.isc.org (drugs.dv.isc.org [130.155.191.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id 83BDB43EF2 for ; Thu, 19 Dec 2002 17:48:15 -0800 (PST) (envelope-from marka@drugs.dv.isc.org) Received: from drugs.dv.isc.org (localhost [127.0.0.1]) by drugs.dv.isc.org (8.12.6/8.12.6) with ESMTP id gBK1m7dv048579; Fri, 20 Dec 2002 12:48:07 +1100 (EST) (envelope-from marka@drugs.dv.isc.org) Message-Id: <200212200148.gBK1m7dv048579@drugs.dv.isc.org> To: Ian Lister Cc: Emiel Kollof , freebsd-stable@FreeBSD.ORG From: Mark.Andrews@isc.org Subject: Re: pthread woes In-reply-to: Your message of "Fri, 20 Dec 2002 11:40:27 +1000." Date: Fri, 20 Dec 2002 12:48:07 +1100 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > On Fri, 20 Dec 2002, Emiel Kollof wrote: > >I have a problem with compiling stuff that uses POSIX threads. I used > >the following snippet of code to test: > > >% gcc test.c -o test.c > > >It compiles fine when I use -lc_r. This also breaks a lot of ports. What's > >going on? > > pthread(3) notes that there is is -pthread option to gcc to save you > needing to link with -lc_r explicitly. > > Ian It also sets appropriate defines so that threaded applications are built correctly. You will get undefined results if you build threaded applications without using -pthread (or manually doing everything it does). Mark -- Mark Andrews, Internet Software Consortium 1 Seymour St., Dundas Valley, NSW 2117, Australia PHONE: +61 2 9871 4742 INTERNET: Mark.Andrews@isc.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message