From owner-freebsd-ports@FreeBSD.ORG Tue Apr 29 12:41:29 2003 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 8672637B401 for ; Tue, 29 Apr 2003 12:41:29 -0700 (PDT) Received: from ms-smtp-02.southeast.rr.com (ms-smtp-02.southeast.rr.com [24.93.67.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4677143FAF for ; Tue, 29 Apr 2003 12:41:26 -0700 (PDT) (envelope-from marcus@marcuscom.com) Received: from mail4.nc.rr.com (fe4 [24.93.67.51])h3TJdDh0012093; Tue, 29 Apr 2003 15:39:15 -0400 (EDT) Received: from creme-brulee.marcuscom.com ([66.57.17.158]) by mail4.nc.rr.com with Microsoft SMTPSVC(5.5.1877.757.75); Tue, 29 Apr 2003 15:43:22 -0400 Received: from [10.2.1.4] (vpn-client-4.marcuscom.com [10.2.1.4]) h3TJcbaa091728; Tue, 29 Apr 2003 15:38:37 -0400 (EDT) (envelope-from marcus@marcuscom.com) From: Joe Marcus Clarke To: Philip Paeps In-Reply-To: <20030429192849.GK643@juno.home.paeps.cx> References: <20030429002250.GM643@juno.home.paeps.cx> <1051577165.40488.5.camel@shumai.marcuscom.com> <20030429024257.GT643@juno.home.paeps.cx> <1051585952.41275.8.camel@shumai.marcuscom.com> <1051633366.326.7.camel@gyros> <20030429192849.GK643@juno.home.paeps.cx> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-j/LbLzrX0JX2O0eb8XIn" Organization: MarcusCom, Inc. Message-Id: <1051645269.326.29.camel@gyros> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 Apr 2003 15:41:10 -0400 X-Spam-Status: No, hits=-39.4 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,PGP_SIGNATURE_2, QUOTED_EMAIL_TEXT,QUOTE_TWICE_1,REFERENCES, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) cc: freebsd-ports@freebsd.org Subject: Re: Loads of undefined reference to `pthread_foo` 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, 29 Apr 2003 19:41:29 -0000 --=-j/LbLzrX0JX2O0eb8XIn Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2003-04-29 at 15:28, Philip Paeps wrote: > On 2003-04-29 12:22:47 (-0400), Joe Marcus Clarke = wrote: > > On Tue, 2003-04-29 at 07:31, Philip Paeps wrote: > > > On 2003-04-28 23:12:33 (-0400), Joe Marcus Clarke wrote: > > > > On Mon, 2003-04-28 at 22:42, Philip Paeps wrote: > > > > > Mmm, it seems as though www/mod_php4 isn't compiling. It's givin= g the same > > > > > errors as above. From work/php4.3.1/config.log: > > > > >=20 > > > > > [...] > > > > > /usr/local/lib/libxml2.so: undefined reference to `pthread_se= tspecific' > > > > > [...] > > > > >=20 > > > > > I'm trying to figure out where in the configure script best to ad= d the > > > > > -pthread bit. > > > >=20 > > > > You shouldn't need to. What does: > > > >=20 > > > > xml2-config --libs > > > >=20 > > > > report? It should contain -pthread. > > >=20 > > > That gives me: > > >=20 > > > (pub:/usr/ports/www/mod_php4)# xml2-config --libs > > > -L/usr/local/lib -lxml2 -lz -pthread -L/usr/local/lib -liconv -lm > > > -L/usr/local/lib > > >=20 > > > For some reason, PHP doesn't seem to be picking it up though :-/ > >=20 > > Yeah, I looked further at PHP's configure, and it explicitly filters ou= t > > -lc_r and -pthread. I add a flag to libxml2 to build it without thread > > support. Rebuild libxml2 with -DLIBXML_WITHOUT_THREADS, and you should= be > > set with PHP. =20 >=20 > Thanks! That works :-) >=20 > > I wonder if it would be okay to allow -pthread in mod_php (of course, > > FreeBSD may prevent -pthread from being linked in to the final mod_php = .so). >=20 > I seem to recall that there was a reason for disabling pthread, at least = on > FreeBSD-4? Marcel Moolenaar responded to my hackers@ question on the subject. Here is my question: "I've noticed something I think is strange with gcc, the -shared flag, and -pthread on -STABLE. I'm hoping someone can enlighten me as to why this happens or if it's a bug. If I compile something with the following command, I do not see libc_r.so linked in the resulting object..." And Marcel's response: "The -shared option tells the compiler driver that you're trying to create a shared object. In that case -lc_r is not added to the link line. Adding -lc_r explicitly is dangerous, because now the linker will construct a shared object that has code linked in from an archive library that has not been compiled with PIC. Consequently, some architectures (eg ia64) may barf when you try to link against this shared object because it may contain invalid relocations. Using -Wl,-shared tricks the compiler driver in thinking you are creating an executable. It will therefore make sure dependencies are correct by adding -lc_r on the link line. You tell the linker however that you're creating a shared object, but now it also has -lc_r explicitly. Again, this can result in a bad shared object. I don't think there's a bug." And from the commit message to bsd.port.mk that adds -pthread for -STABLE and -lc_r for -CURRENT: "Add new variables PTHREAD_CFLAGS and PTHREAD_LIBS to help the transition with the new pthread linking scheme." Apparently, after 500016, libc and libc_r can now be linked together. Joe >=20 > - Philip --=20 PGP Key : http://www.marcuscom.com/pgp.asc --=-j/LbLzrX0JX2O0eb8XIn 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+rtVVb2iPiv4Uz4cRAuBVAJ0Ut6i9zo62lo0y0dxuA/QvtkfFNQCgiXXg e3DD7n8s4yh3I8ac+nOuPj8= =N8Tw -----END PGP SIGNATURE----- --=-j/LbLzrX0JX2O0eb8XIn--