Uses PTHREAD_CFLAGS and PTHREADS_LIBS when WITH_THREADS is used, as suggested by marcus. This fixes various problems with both non-threaded and threaded Perl programs.
Responsible Changed From-To: freebsd-ports-bugs->tobez Grab.
Actually, I think PTHREAD_CFLAGS and PTHREADS_LIBS must be moved out of the WITH_THREADS section, since they're also needed when a non-threaded Perl uses threaded bindings. Joe Marcus Clark says: "It seems to me, the fact that Perl itself is not linked to ${PTHREAD_LIBS} should cause a big problem. The thread guys have already said (and I've seen this) that one cannot dynamically load a threaded module into a non-threaded running program (which I think sucks, but that's life as it were)." In such case this PR also applies to the lang/perl5 port. -- Jean-Yves Lefort jylefort@brutele.be http://lefort.be.eu.org/
This PR is blocking ports/73063 and ports/73062. Any idea when this is going to be commited? (I trust Jean-Yves enough to commit it myself if you prefer that)
On Thu, Oct 28, 2004 at 12:15:02PM +0200, Jean-Yves Lefort wrote: > >Description: > Uses PTHREAD_CFLAGS and PTHREADS_LIBS when WITH_THREADS is used, as > suggested by marcus. > > This fixes various problems with both non-threaded and threaded Perl > programs. > >How-To-Repeat: > >Fix: > diff -ruN /usr/ports/lang/perl5.8/Makefile perl5.8/Makefile > --- /usr/ports/lang/perl5.8/Makefile Fri Jul 30 12:36:09 2004 > +++ perl5.8/Makefile Thu Oct 28 11:55:43 2004 > @@ -7,6 +7,7 @@ > > PORTNAME= perl > PORTVERSION= ${PERL_VER} > +PORTREVISION= 1 > CATEGORIES= lang devel perl5 > MASTER_SITES= ${MASTER_SITE_PERL_CPAN} \ > ${MASTER_SITE_LOCAL:S/$/:local/} \ > @@ -26,6 +27,10 @@ > USE_BZIP2= yes > HAS_CONFIGURE= yes > CONFIGURE_SCRIPT=Configure > + > +CCFLAGS= -DAPPLLIB_EXP=\"${BSDPAN_DEST}\" > +LIBS= -lm > + > CONFIGURE_ARGS= -sde -Dprefix=${PREFIX} \ > -Darchlib=${PREFIX}/lib/perl5/${PERL_VER}/${PERL_ARCH} \ > -Dprivlib=${PREFIX}/lib/perl5/${PERL_VER} \ > @@ -37,7 +42,7 @@ > -Dsiteman1dir=${PREFIX}/man/man1 \ > -Ui_malloc -Ui_iconv -Uinstallusrbinperl \ > -Dcc="${CC}" -Doptimize="${CFLAGS}" -Duseshrplib \ > - -Dccflags=-DAPPLLIB_EXP=\"${BSDPAN_DEST}\" > + -Dccflags="${CCFLAGS}" -Dlibs="${LIBS}" > > INCLUDEDIR= /usr/include > > @@ -70,6 +75,8 @@ > > .if defined(WITH_THREADS) > CONFIGURE_ARGS+= -Dusethreads=y > +CCFLAGS+= ${PTHREAD_CFLAGS} > +LIBS+= ${PTHREAD_LIBS} > PKGNAMESUFFIX= -threaded > # it seems perl malloc has problems with threaded perl on FreeBSD > .undef WITH_PERL_MALLOC Actually, there is a much better way to do it, since using -Dlibs breaks a lot of things that a probed by perl Configure. Regardless, have you actually tested this patch on FreeBSD 5.X and or -CURRENT? I am having substantial problems with threaded perl (5.8.6) that uses correct thread libraries. I realize that the current way of blindly link with libc_r is broken, but at least it sort of worked. :-) \Anton. -- The moronity of the universe is a monotonically increasing function. -- Jarkko Hietaniemi
On Mon, 31 Jan 2005 13:44:54 +0100 Anton Berezin <tobez@FreeBSD.org> wrote: > On Thu, Oct 28, 2004 at 12:15:02PM +0200, Jean-Yves Lefort wrote: > > > >Description: > > Uses PTHREAD_CFLAGS and PTHREADS_LIBS when WITH_THREADS is used, as > > suggested by marcus. > > > > This fixes various problems with both non-threaded and threaded Perl > > programs. > > >How-To-Repeat: > > >Fix: > > diff -ruN /usr/ports/lang/perl5.8/Makefile perl5.8/Makefile > > --- /usr/ports/lang/perl5.8/Makefile Fri Jul 30 12:36:09 2004 > > +++ perl5.8/Makefile Thu Oct 28 11:55:43 2004 > > @@ -7,6 +7,7 @@ > > > > PORTNAME= perl > > PORTVERSION= ${PERL_VER} > > +PORTREVISION= 1 > > CATEGORIES= lang devel perl5 > > MASTER_SITES= ${MASTER_SITE_PERL_CPAN} \ > > ${MASTER_SITE_LOCAL:S/$/:local/} \ > > @@ -26,6 +27,10 @@ > > USE_BZIP2= yes > > HAS_CONFIGURE= yes > > CONFIGURE_SCRIPT=Configure > > + > > +CCFLAGS= -DAPPLLIB_EXP=\"${BSDPAN_DEST}\" > > +LIBS= -lm > > + > > CONFIGURE_ARGS= -sde -Dprefix=${PREFIX} \ > > -Darchlib=${PREFIX}/lib/perl5/${PERL_VER}/${PERL_ARCH} \ > > -Dprivlib=${PREFIX}/lib/perl5/${PERL_VER} \ > > @@ -37,7 +42,7 @@ > > -Dsiteman1dir=${PREFIX}/man/man1 \ > > -Ui_malloc -Ui_iconv -Uinstallusrbinperl \ > > -Dcc="${CC}" -Doptimize="${CFLAGS}" -Duseshrplib \ > > - -Dccflags=-DAPPLLIB_EXP=\"${BSDPAN_DEST}\" > > + -Dccflags="${CCFLAGS}" -Dlibs="${LIBS}" > > > > INCLUDEDIR= /usr/include > > > > @@ -70,6 +75,8 @@ > > > > .if defined(WITH_THREADS) > > CONFIGURE_ARGS+= -Dusethreads=y > > +CCFLAGS+= ${PTHREAD_CFLAGS} > > +LIBS+= ${PTHREAD_LIBS} > > PKGNAMESUFFIX= -threaded > > # it seems perl malloc has problems with threaded perl on FreeBSD > > .undef WITH_PERL_MALLOC > > Actually, there is a much better way to do it, since using -Dlibs breaks > a lot of things that a probed by perl Configure. I don't see what it breaks, but if you have a better way just use it. I'm not exactly proficient with the Perl build system. > Regardless, have you actually tested this patch on FreeBSD 5.X and or > -CURRENT? I am having substantial problems with threaded perl (5.8.6) > that uses correct thread libraries. I realize that the current way of > blindly link with libc_r is broken, but at least it sort of worked. :-) I've been running the patched port (perl-threaded-5.8.5_1) for months on 5.3 without any problem. Please note that some bindings simply do not run at all without this patch (73062 for instance). -- Jean-Yves Lefort jylefort@brutele.be http://lefort.be.eu.org/
On Mon, 31 Jan 2005 16:09:51 +0100 Anton Berezin <tobez@FreeBSD.org> wrote: > On Mon, Jan 31, 2005 at 02:03:55PM +0100, Jean-Yves Lefort wrote: > > On Mon, 31 Jan 2005 13:44:54 +0100 > > Anton Berezin <tobez@FreeBSD.org> wrote: > > > > Actually, there is a much better way to do it, since using -Dlibs breaks > > > a lot of things that a probed by perl Configure. > > > > I don't see what it breaks, but if you have a better way just use > > it. I'm not exactly proficient with the Perl build system. > > It breaks WITH_GDBM, for example. The problem is that explicit -Dlibs > are not very nice. All the tests but one succeed: lib/ExtUtils/t/Embed......................Unrecognized argument in LIBS ignored: '-pthread' FAILED at test 2 > Anyway, it seems I found what I was doing wrong, so after a bit more > testing I am doing an update which will incorporate the proper threading > model. Great. :) > I am a bit uneasy with regard to enabling compilation with thread > libraries even for non-threaded perl. I think this should work fine on > 5.X and -CURRENT, but I am not so sure about 4.X. That is, while it is > true that using non-thread-aware perl with thread-aware extensions might > lead to problems, it also seems true that using thread-aware perl with > non-thread-aware extensions might lead to problems as well. Good point. Perhaps a solution would be to IGNORE the port on 4.x. -- Jean-Yves Lefort jylefort@brutele.be http://lefort.be.eu.org/
On Mon, Jan 31, 2005 at 04:19:07PM +0100, Jean-Yves Lefort wrote: > On Mon, 31 Jan 2005 16:09:51 +0100 > Anton Berezin <tobez@FreeBSD.org> wrote: > > I am a bit uneasy with regard to enabling compilation with thread > > libraries even for non-threaded perl. I think this should work fine on > > 5.X and -CURRENT, but I am not so sure about 4.X. That is, while it is > > true that using non-thread-aware perl with thread-aware extensions might > > lead to problems, it also seems true that using thread-aware perl with > > non-thread-aware extensions might lead to problems as well. > > Good point. Perhaps a solution would be to IGNORE the port on 4.x. That is obviously a bad idea. :-) Anyway, I discussed this with a couple of people, so for now - fixed WITH_THREADS are in, thread libraries for non-threaded perl are out. Cheers, \Anton. -- The moronity of the universe is a monotonically increasing function. -- Jarkko Hietaniemi
State Changed From-To: open->closed A different fix applied to lang/perl5.8. It is still an open question whether to always compile perl with threaded libraries (even for a non-threaded perl).