almond has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
I want to build perl in debug mode. My intention is to put a perl script under gdb. But when I build perl in debug mode, I encounter some errors. Some of the tests are failing:
1. weak.t Error: ------ Weak references are not implemented in the version of perl at ../ +ext/Storable/t/weak.t line 28 BEGIN failed--compilation aborted at ../ext/Storable/t/weak.t line 33. 2. DB.t Error: ------ "-T" is on the #! line, it must also be used on the command line at .. +/lib/DB.t line 1. 3. threads.t

More Info have been given on this problem ... follow the thread ...

Replies are listed 'Best First'.
Re: Perl Debug Build
by almut (Canon) on Apr 25, 2009 at 10:14 UTC
    Weak references are not implemented ...

    Normally, that problem is related to a version of Scalar::Util that hasn't been built with XS support. Scalar::Util can in principle be built as a pure Perl module with restricted functionality (e.g. no weaken routine), or as the fully functioning XS version.  Storable's weak.t test loads Scalar::Util, which is where you're getting the error, because Scalar::Util realizes it doesn't have XS support and thus can't honor the import requests:

    ... require Scalar::Util; Scalar::Util->import(qw(weaken isweak)); # line 28 in weak.t if (grep { /weaken/ } @Scalar::Util::EXPORT_FAIL) { print("1..0 # Skip: No support for weaken in Scalar::Util\n"); exit 0; }

    Now, the real question is, why do you have a non-XS Scalar::Util?  A couple of possible reasons:

    • Your version of Perl is too old (< v5.6) and truly doesn't support weak references  (unlikely)
    • Due to a configure error, Scalar::Util has been built as the pure Perl version
    • A wrong version of Scalar::Util is being loaded (e.g. from a different installation of Perl), for example because you have PERL5LIB pointing to directories which don't belong to the version of Perl you're currently dealing with.
    • Scalar::Util's associated (existing) .so file isn't being loaded for whatever reason.
    • ...

    So... What version(s) of Perl do you have on that machine? Which version are you trying to build with debug support? What were the configure options you used (post output of perl -V)? Any unusual messages/errors during configuring/building? Which platform are you on?

    PS. see also Weak references are not implemented and Test::Deep - weak references are not implemented

      What version(s) of Perl do you have on that machine? -5.8.8
      Which version are you trying to build with debug support? 5.8.8
      What were the configure options you used (post output of perl -V)?
      $ ./perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=hpux, osvers=11.23, archname=IA64.ARCHREV_0-thread-multi uname='hp-ux myserver b.11.23 u ia64 0356346628 unlimited-user lic +ense ' config_args='-Dmksymlinks -DEBUGGING=both -ders -Dcc=cc -Dusethrea +ds -Duseithreads -Ud_sigsetjmp -Uinstallusrbinperl -Ulocincpth= -Uloc +libpth= -Dsh=/usr/bin/sh -Dd_attribut=undef -Dd_attribute_warn_unused +_result=undef -Dd_u32align=define -Aprepend:libswanted=cl -Dvendorpr +efix=/opt/perl_32 -Accflags=+DSitanium2 -Doptimize=-g -Accflags=+Z -A +ccflags=-DUSE_SITECUSTOMIZE -Duselargefiles -Accflags=-DNO_HASH_SEED +-Dprefix=/opt/perl_32 -Dinc_version_list=5.8.7/$archname 5.8.7 5.8.6/ +$archname 5.8.6 5.8.4/$archname 5.8.4 5.8.3/$archname 5.8.3 5.8.2/$ar +chname 5.8.2 5.8.1/$archname 5.8.1 5.8.0/$archname 5.8.0 -Dsed=/usr/b +in/sed -Duseshrplib -Dconfig_heavy=Config_dynamic.pl -Dlibpth=/usr/li +b/hpux32 -Dperladmin=abc@pqr.com -Dcf_email=abc@pqr.com -Dcf_by=Almon +d' . . .
      Any unusual messages/errors during configuring/building? No
      Which platform are you on? hp-ux 11.23 IA machine

        Please run the following command to find out where the Scalar/Util.pm is being loaded from, and if the corresponding Util.so is found:

        $ PERL_CORE=1 tusc ./perl ext/Storable/t/weak.t | grep Util

        This must be run from the main build directory, where the perl binary is located.

        The normal output from this - with a fully functioning Scalar::Util - would look like this:

        stat64("./Scalar/Util.pmc", 0x7fffdf30) ............. ... ERR#2 ENOENT stat64("./Scalar/Util.pm", 0x7fffdeb0) .............. ... ERR#2 ENOENT stat64("../lib/Scalar/Util.pmc", 0x7fffdf30) ........ ... ERR#2 ENOENT stat64("../lib/Scalar/Util.pm", 0x7fffdeb0) ......... ... = 0 open("../lib/Scalar/Util.pm", O_RDONLY|0x800, 0666) . ... = 4 stat64("./List/Util.pmc", 0x7fffdf30) ............... ... ERR#2 ENOENT stat64("./List/Util.pm", 0x7fffdeb0) ................ ... ERR#2 ENOENT stat64("../lib/List/Util.pmc", 0x7fffdf30) .......... ... ERR#2 ENOENT stat64("../lib/List/Util.pm", 0x7fffdeb0) ........... ... = 0 open("../lib/List/Util.pm", O_RDONLY|0x800, 0666) ... ... = 4 stat64("../lib/auto/List/Util/Util.so", 0x40011090) . ... = 0 stat64("../lib/auto/List/Util/Util.bs", 0x40011090) . ... = 0 open("../lib/auto/List/Util/Util.so", O_RDONLY, 0) .. ... = 4 open("../lib/auto/List/Util/Util.so", O_RDONLY, 0) .. ... = 4

        In case you don't get any output, make sure you can run the test itself (without tusc), i.e.

        $ PERL_CORE=1 ./perl ext/Storable/t/weak.t

        Alternatively, you could try to just load the module Scalar::Util and import weaken (output should be similar to above):

        $ tusc ./perl -I./lib -MScalar::Util=weaken -e1 | grep Util

        And if you find that you do have a Util.so, you might want to check whether it has been compiled properly (contains the required symbols):

        $ nm ./lib/auto/List/Util/Util.so | grep weak + [77] | 0| 0|FUNC |GLOB |0| UNDEF|Perl_sv_rvweak +en [102] | 67145504| 384|FUNC |GLOB |0| .text|XS_Scalar__Uti +l_isweak [66] | 67145184| 288|FUNC |GLOB |0| .text|XS_Scalar__Uti +l_weaken

        Also (just in case) you could check for other perls:

        $ find /opt/perl* -path "*bin/perl" $ find /opt/perl* -path "*bin/perl" -exec {} -v \; | grep 'is perl'

        ...because at least the code from Perl's Configure, which populates @inc_version_list, apparently did find directories for versions from 5.8.0 all through to 5.8.7.  This doesn't necessarily mean that all those are full installations, but it's at least a hint that there are - or have been - other versions of Perl on that machine, which might interfere under some circumstances (like PERL5LIB being set)...