From owner-freebsd-ports@FreeBSD.ORG Tue Jun 8 05:39:10 2004 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ECC5C16A4CE; Tue, 8 Jun 2004 05:39:09 +0000 (GMT) Received: from creme-brulee.marcuscom.com (rrcs-midsouth-24-172-16-118.biz.rr.com [24.172.16.118]) by mx1.FreeBSD.org (Postfix) with ESMTP id 790A643D39; Tue, 8 Jun 2004 05:39:09 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from [192.168.1.4] (shumai.marcuscom.com [192.168.1.4]) i585cBcS096920; Tue, 8 Jun 2004 01:38:11 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: ports@FreeBSD.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-kGu/fEh+/dRdDqPHHbJS" Organization: FreeBSD, Inc. Message-Id: <1086673141.18374.35.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 08 Jun 2004 01:39:02 -0400 X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on creme-brulee.marcuscom.com Subject: RFC: [Long] Change PTHREAD_LIBS to -pthread for -CURRENT X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2004 05:39:10 -0000 --=-kGu/fEh+/dRdDqPHHbJS Content-Type: text/plain Content-Transfer-Encoding: quoted-printable I'm not sure how many of you have seen the recent thread (no pun intended) on either ports@, current@, gnome@, or threads@ about the problems with linking shared objects with -lpthread on -CURRENT. Basically, when shared objects are explicitly linked with -lpthread, they retain a link to the libpthread. This means that any executable which links to these libraries must also link to libpthread. If they do not, they will most certainly crash or behave erratically (this also includes any dynamically loadable objects). Some examples of this include the gnome-vfs gtk+ file system backend, apache2/php4, nss_ldap, wine, etc. Note: if the shared object actually contains pthread symbols, then any executable that links to it will still have to be linked with -pthread, but in the examples above, this is not the case. To get around this, we can use -pthread to link shared objects as well as executables. This works exactly the same way as in 4.X. By using -pthread, when shared objects are linked, libpthread will only be used to resolve symbols at link-time, but the resulting shared object will not retain a link to libpthread. (One way to test this is to write a simple helloworld.c, and compile it with ``cc -shared -o helloworld.so -pthread helloworld.c'' and ``cc -shared -o helloworld.so -lpthread helloworld.c'', then look at the resulting helloworld.so files with ldd). So, I propose changing PTHREAD_LIBS to -pthread for -CURRENT. This will match what we have in 4.X, and will last for the life of 5.X going forward. The threading people tell me this is doable now. Thoughts? Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-kGu/fEh+/dRdDqPHHbJS Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQBAxVD1b2iPiv4Uz4cRAvYHAJ9rXwWUUApGcCnKN/5cmJBBKnKP1QCgq8kV Hzb72TPy4vH3N+q5ZWk1tD4= =XyDL -----END PGP SIGNATURE----- --=-kGu/fEh+/dRdDqPHHbJS--