Bug 73233 - Update port: lang/perl5.8 (fix threads support)
Summary: Update port: lang/perl5.8 (fix threads support)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Anton Berezin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-28 11:20 UTC by Jean-Yves Lefort
Modified: 2005-02-02 09:56 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (1.14 KB, patch)
2004-10-28 11:20 UTC, Jean-Yves Lefort
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Lefort 2004-10-28 11:20:24 UTC
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.
Comment 1 Anton Berezin freebsd_committer freebsd_triage 2004-10-28 11:30:42 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tobez

Grab.
Comment 2 Jean-Yves Lefort 2004-10-28 11:31:30 UTC
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/
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2004-12-22 02:13:22 UTC
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)
Comment 4 Anton Berezin freebsd_committer freebsd_triage 2005-01-31 12:44:54 UTC
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
Comment 5 Jean-Yves Lefort 2005-01-31 13:03:55 UTC
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/
Comment 6 Jean-Yves Lefort 2005-01-31 15:19:07 UTC
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/
Comment 7 Anton Berezin freebsd_committer freebsd_triage 2005-01-31 15:39:17 UTC
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
Comment 8 Anton Berezin freebsd_committer freebsd_triage 2005-02-02 09:55:41 UTC
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).