From owner-freebsd-stable Thu Dec 19 17:51: 2 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 9174937B401 for ; Thu, 19 Dec 2002 17:51:00 -0800 (PST) Received: from creme-brulee.marcuscom.com (rdu57-17-158.nc.rr.com [66.57.17.158]) by mx1.FreeBSD.org (Postfix) with ESMTP id B6F8C43EE5 for ; Thu, 19 Dec 2002 17:50:59 -0800 (PST) (envelope-from marcus@marcuscom.com) Received: from [192.168.1.4] (shumai.marcuscom.com [192.168.1.4]) by creme-brulee.marcuscom.com (8.12.6/8.12.6) with ESMTP id gBK1o33a063006; Thu, 19 Dec 2002 20:50:03 -0500 (EST) (envelope-from marcus@marcuscom.com) Subject: Re: pthread woes From: Joe Marcus Clarke To: Emiel Kollof Cc: freebsd-stable@FreeBSD.ORG In-Reply-To: <20021220013445.GA75547@hackerheaven.org> References: <20021220013445.GA75547@hackerheaven.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-AchKwlcNytTRZAzi2pFw" Organization: MarcusCom, Inc. Message-Id: <1040349062.2280.5.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 19 Dec 2002 20:51:02 -0500 X-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,IN_REP_TO,NOSPAM_INC,PGP_SIGNATURE_2,QUOTED_EMAIL_TEXT, REFERENCES,SPAM_PHRASE_01_02 version=2.43 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 --=-AchKwlcNytTRZAzi2pFw Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2002-12-19 at 20:34, Emiel Kollof wrote: > When I compile it, I get the following errors: >=20 > % gcc test.c -o test.c > /tmp/ccF3QI1k.o: In function `PrintHello': > /tmp/ccF3QI1k.o(.text+0x20): undefined reference to `pthread_exit' > /tmp/ccF3QI1k.o: In function `main': > /tmp/ccF3QI1k.o(.text+0x76): undefined reference to `pthread_create' > /tmp/ccF3QI1k.o(.text+0xba): undefined reference to `pthread_exit' >=20 > It compiles fine when I use -lc_r. This also breaks a lot of ports. What'= s > going on? On 4.x, you need to compile threaded applications with the -pthread flag. On 5.x, you should use -lc_r. When linking with pthread or libc_r, you should not also link with libc as this has been known to cause problems with multi-threaded applications. What ports are broken because of this? Any port which can't find -pthread or -lc_r on its own should have ${PTHREAD_LIBS} added to its LIBS configure argument. With that, there are also some thread-related CFLAGS that should be added. These are defined by the ports system as ${PTHREAD_CFLAGS}. Joe >=20 > Cheers, > Emiel --=20 PGP Key : http://www.marcuscom.com/pgp.asc --=-AchKwlcNytTRZAzi2pFw Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQA+AneGb2iPiv4Uz4cRAlLqAKCiAWEK2q6v1DAHnPXvLVy0+8g8mACeNRld YixOa02RiARKT+eapSVF3RE= =JMK1 -----END PGP SIGNATURE----- --=-AchKwlcNytTRZAzi2pFw-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message