You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Frankl <mf...@seibert-media.net> on 2006/11/08 14:29:13 UTC

Weak references, problem with apache2/mod_perl2

Hi,

I have a problem running an application (catalyst-based) under
apache2/mod_perl2. The app runs fine with catalyst standalone server
(which is included in catalyst). But when I try to run it under mod_perl
on the same machine, i am getting the error below in apache-errorlog.

---------------
[Mon Nov 06 00:21:45 2006] [error] Weak references are not implemented
in the version of perl at /usr/lib/perl5/site_perl/5.8.8/Catalyst.pm
line 22\nBEGIN failed--compilation aborted
at /usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 22.\nCompilation
failed in require at /home/test/Friends/lib/Friends.pm line 23.\nBEGIN
failed--compilation aborted at /home/test/Friends/lib/Friends.pm line
23.\nCompilation failed in require at (eval 11) line 1.\n
---------------

In Catalyst.pm line 22 Scalar::Util is used with 'weakened'-Option.

use Scalar::Util qw/weaken blessed/;

It can not be my perl itself, because the standalone server is running,
or am i wrong? I already tried to recompile mod_perl without success. I
think the problem must be located in mod_perl or its configuration. In
the mod_perl sources i could not find any hints regarding weak
references. I am using gentoo Linux and installed apache2 and mod_perl2
using portage.

Any hints are welcome.
Thank you,
Michael


Re: Weak references, problem with apache2/mod_perl2

Posted by Michael Frankl <mf...@seibert-media.net>.
Hello Perrin,

Am Freitag, den 10.11.2006, 15:29 -0500 schrieb Perrin Harkins:
> Sorry, I'm not sure what to suggest for your next step.  Maybe contact
> the author of Scalar::Util.  Or maybe recompile your system perl so it
> will support weak refs without installing a separate module. 

I already searched for a possibility to compile perl supporting weak
refs directly, but I could not find the right compile-option until now.
In the meantime I testet the same issue with freebsd and macosx, without
errors :-(. So it really seems to be a gentoo-perl issue.

Thank you for your time, I will post here if there is a solution.

michael


Re: Weak references, problem with apache2/mod_perl2

Posted by Fred Moyer <fr...@redhotpenguin.com>.
On Fri, 10 Nov 2006, Perrin Harkins wrote:

> On Fri, 2006-11-10 at 14:24 +0100, Michael Frankl wrote:
>> I cleaned up the perl-installation. There where directories
>> under /usr/lib/perl5 from previous perl installations. I deleted them
>> all. I deleted the Scalar::Util that is not from main distribution. Now
>> I got the same error running the catalyst standalone server, complaining
>> that weak references are not implemented in this version of perl.
>
> Okay, at least you know for sure that they were using different modules
> then.  You might want to talk to whoever maintains Perl for Gentoo about
> fixing that.

Apologies if this is getting off topic, but you may want to run the 
'perl-cleaner' script supplied with the Gentoo Perl upgrade.  That should 
fixup any previous mod_perl versions (at least in theory).

Re: Weak references, problem with apache2/mod_perl2

Posted by Perrin Harkins <pe...@elem.com>.
On Fri, 2006-11-10 at 14:24 +0100, Michael Frankl wrote:
> I cleaned up the perl-installation. There where directories
> under /usr/lib/perl5 from previous perl installations. I deleted them
> all. I deleted the Scalar::Util that is not from main distribution. Now
> I got the same error running the catalyst standalone server, complaining
> that weak references are not implemented in this version of perl.

Okay, at least you know for sure that they were using different modules
then.  You might want to talk to whoever maintains Perl for Gentoo about
fixing that.

> Now i installed Scalar::Util again via CPAN. Catalyst Standalone-Server
> is running again, mod_perl fails. They use the same Module. I checked
> this by printing a warn from the module.

Very strange.  See what they each have in %INC for Scalar::Util.

> What I am not sure of is what
> about the xs that is used. I found some hints while googling that this
> error occurres if the XS-Version is not installed. But I have no idea
> how to go on. Any idea?

The XS version is what I would expect you to get when you compile it.
Looking at the code, it seems like it gives a different error when you
don't have it.

If both of them use the same module, I'm at a loss for what could be
going on.  I don't think mod_perl could change the behavior of this
module, so I still believe it has something to do with loading a
different version of the module or a different perl lib, but your
investigations seem to show dead ends there.

Sorry, I'm not sure what to suggest for your next step.  Maybe contact
the author of Scalar::Util.  Or maybe recompile your system perl so it
will support weak refs without installing a separate module.

- Perrin


Re: Weak references, problem with apache2/mod_perl2

Posted by Michael Frankl <mf...@seibert-media.net>.
Hi,

Am Donnerstag, den 09.11.2006, 13:48 -0500 schrieb Perrin Harkins:
> > So that means, that mod_perl is not compiled with the same perl as is
> > used by the standalone server!?
> 
> Yes, I don't know any way to disable weak references without recompiling
> Scalar::Util, which is part of the main distribution.  It is possible
> that you installed a second version of Scalar::Util, which is in @INC in
> one case and not the other.  Check your system for multiple copies of
> Scalar/Util.pm.
> 

I cleaned up the perl-installation. There where directories
under /usr/lib/perl5 from previous perl installations. I deleted them
all. I deleted the Scalar::Util that is not from main distribution. Now
I got the same error running the catalyst standalone server, complaining
that weak references are not implemented in this version of perl.

Now i installed Scalar::Util again via CPAN. Catalyst Standalone-Server
is running again, mod_perl fails. They use the same Module. I checked
this by printing a warn from the module. What I am not sure of is what
about the xs that is used. I found some hints while googling that this
error occurres if the XS-Version is not installed. But I have no idea
how to go on. Any idea?

thanks,
Michael



Re: Weak references, problem with apache2/mod_perl2

Posted by Perrin Harkins <pe...@elem.com>.
On Thu, 2006-11-09 at 11:24 +0100, Michael Frankl wrote:
> Ok, I testet this:
> perl -e "use Scalar::Util qw/weaken blessed/;"
> 
> Runs without any complains. Used directly in the script started by
> Apache writes the same message to errorlog:
> ---------------------
> [Thu Nov 09 10:37:23 2006] [error] Weak references are not implemented
> in the version of perl
> at /etc/apache2/modules.d/apache2-mod_perl-startup.pl line 24\nBEGIN
> failed--compilation aborted
> at /etc/apache2/modules.d/apache2-mod_perl-startup.pl line
> 24.\nCompilation failed in require at (eval 2) line 1.\n
> ---------------------
> 
> So that means, that mod_perl is not compiled with the same perl as is
> used by the standalone server!?

Yes, I don't know any way to disable weak references without recompiling
Scalar::Util, which is part of the main distribution.  It is possible
that you installed a second version of Scalar::Util, which is in @INC in
one case and not the other.  Check your system for multiple copies of
Scalar/Util.pm.

> I looked a bit further to verify. First an ldd on mod_perl.so used by
> Apache:
> ----------------------
> mobile-mf modules # ldd mod_perl.so
>         linux-gate.so.1 =>  (0xffffe000)
>         libperl.so.1 => /usr/lib/libperl.so.1 (0xb7ea5000)
>         libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7e93000)
>         libnsl.so.1 => /lib/libnsl.so.1 (0xb7e7e000)
>         libdl.so.2 => /lib/libdl.so.2 (0xb7e7a000)
>         libm.so.6 => /lib/tls/libm.so.6 (0xb7e58000)
>         libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7e2b000)
>         libutil.so.1 => /lib/libutil.so.1 (0xb7e26000)
>         libc.so.6 => /lib/tls/libc.so.6 (0xb7d13000)
>         /lib/ld-linux.so.2 (0x80000000)
> -----------------------
> 
> Now a look at perl itself:
> /usr/lib/perl5/5.8.8/i686-linux/CORE/libperl.so.1.5.8 
> is identical (a link to the same file).

Are you certain that this is the perl you get when you say "perl" on the
command-line?  Check the results of "which perl".

> Sorry, I meant that I recompiled mod_perl but this did not solve the
> problem :-)

You installed your new compile and nothing changed?  That does make me
more suspicious about having a second copy of Scalar::Util lying around.

> Now perhaps the "perl Makefile.PL" call done by the gentoo-portage could
> help:
> 
> -----------------
> perl Makefile.PL \
>                 PREFIX=${D}/usr \
>                 MP_TRACE=1 \
>                 MP_DEBUG=1 \
>                 MP_USE_DSO=1 \
>                 MP_APXS=/usr/sbin/apxs2  \
>                 CCFLAGS="${CFLAGS} -fPIC" \
>                 TMPDIR=${T} \
>                 INSTALLDIRS=vendor
> ------------------
> 
> Does this give any hints?

No, that looks pretty normal to me.

- Perrin


Re: Weak references, problem with apache2/mod_perl2

Posted by Michael Frankl <mf...@seibert-media.net>.
Am Mittwoch, den 08.11.2006, 12:39 -0500 schrieb Perrin Harkins:
> > It can not be my perl itself, because the standalone server is running,
> > or am i wrong?
> 
> It probably means that your mod_perl was not compiled with the same perl
> that you're running the standalone server on.  Either that, or Catalyst
> doesn't run this line when you use it under the standalone server.
> 

Ok, I testet this:
perl -e "use Scalar::Util qw/weaken blessed/;"

Runs without any complains. Used directly in the script started by
Apache writes the same message to errorlog:
---------------------
[Thu Nov 09 10:37:23 2006] [error] Weak references are not implemented
in the version of perl
at /etc/apache2/modules.d/apache2-mod_perl-startup.pl line 24\nBEGIN
failed--compilation aborted
at /etc/apache2/modules.d/apache2-mod_perl-startup.pl line
24.\nCompilation failed in require at (eval 2) line 1.\n
---------------------

So that means, that mod_perl is not compiled with the same perl as is
used by the standalone server!?

I looked a bit further to verify. First an ldd on mod_perl.so used by
Apache:
----------------------
mobile-mf modules # ldd mod_perl.so
        linux-gate.so.1 =>  (0xffffe000)
        libperl.so.1 => /usr/lib/libperl.so.1 (0xb7ea5000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7e93000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb7e7e000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7e7a000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb7e58000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xb7e2b000)
        libutil.so.1 => /lib/libutil.so.1 (0xb7e26000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7d13000)
        /lib/ld-linux.so.2 (0x80000000)
-----------------------

Now a look at perl itself:
/usr/lib/perl5/5.8.8/i686-linux/CORE/libperl.so.1.5.8 
is identical (a link to the same file).

Can you give me any hints what else I could try to find out if mod_perl
uses another version of perl?

> >  I already tried to recompile mod_perl without success.
> 
> We can help you with that, if you want to try again.

Sorry, I meant that I recompiled mod_perl but this did not solve the
problem :-)

> 
> >  I
> > think the problem must be located in mod_perl or its configuration.
> 
> No, this can't be modified except by recompiling perl itself.
> 

Now perhaps the "perl Makefile.PL" call done by the gentoo-portage could
help:

-----------------
perl Makefile.PL \
                PREFIX=${D}/usr \
                MP_TRACE=1 \
                MP_DEBUG=1 \
                MP_USE_DSO=1 \
                MP_APXS=/usr/sbin/apxs2  \
                CCFLAGS="${CFLAGS} -fPIC" \
                TMPDIR=${T} \
                INSTALLDIRS=vendor
------------------

Does this give any hints?



Thank you,
Michael

Re: Weak references, problem with apache2/mod_perl2

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2006-11-08 at 14:29 +0100, Michael Frankl wrote:
> [Mon Nov 06 00:21:45 2006] [error] Weak references are not implemented
> in the version of perl at /usr/lib/perl5/site_perl/5.8.8/Catalyst.pm
> line 22\nBEGIN failed--compilation aborted
> at /usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 22.\nCompilation
> failed in require at /home/test/Friends/lib/Friends.pm line 23.\nBEGIN
> failed--compilation aborted at /home/test/Friends/lib/Friends.pm line
> 23.\nCompilation failed in require at (eval 11) line 1.\n
> ---------------
[...]
> It can not be my perl itself, because the standalone server is running,
> or am i wrong?

It probably means that your mod_perl was not compiled with the same perl
that you're running the standalone server on.  Either that, or Catalyst
doesn't run this line when you use it under the standalone server.

>  I already tried to recompile mod_perl without success.

We can help you with that, if you want to try again.

>  I
> think the problem must be located in mod_perl or its configuration.

No, this can't be modified except by recompiling perl itself.

- Perrin