【perlメモ】「weaken is only available with the XS version of Scalar::Util」と表示されてperlスクリプトが動かない件

なんだか、前に作ったperlスクリプトが下の様なエラーを吐いて動かなくなっていたので調べてみた。

[kumacchi@rad-xen-vweb7 hogehogehoge]$ perl hogehogehoge.pl
weaken is only available with the XS version of Scalar::Util at /usr/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm line 2503
BEGIN failed–compilation aborted at /usr/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm line 2503.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/XMLRPC/Lite.pm line 13.
BEGIN failed–compilation aborted at /usr/lib/perl5/site_perl/5.8.8/XMLRPC/Lite.pm line 13.
Compilation failed in require at hogehogehoge.pl line 105.
BEGIN failed–compilation aborted at hogehogehoge.pl line 105.
[kumacchi@rad-xen-vweb7 hogehogehoge]$

なんか、Scalar::Utilでエラーっぽいのでcpanからインストールすればいいんじゃないかと思ってやってみたけどもう入ってると言われた。

cpan> install  Scalar::Util
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Sat, 10 Dec 2011 01:31:28 GMT
Scalar::Util is up to date.

検索してみると下記のブログ記事を発見。

解決:Scalar::Util::weakenを使おうとするとWeak references are not implementedで落ちる – ヒルズで働くholidays-lの技ログ

やっぱり、Scalar::Utilを入れなおせばいいらしい。

一応真似して、動作確認とバージョン表示をしてみる。

[root@rad-xen-vweb7 ~]# perl -MScalar::Util=weaken -e 42
weaken is only available with the XS version of Scalar::Util at -e line 0
BEGIN failed–compilation aborted.
[root@rad-xen-vweb7 ~]# perl -MScalar::Util -e ‘print Scalar::Util->VERSION’
1.23[root@rad-xen-vweb7 ~]# perl -MCPAN -e shell

cpanのシェルを起動して強制インストールしてみた。

[root@rad-xen-vweb7 ~]# perl -MCPAN -e shell

cpan shell — CPAN exploration and modules installation (v1.7602)
ReadLine support enabled

Display Information
command  argument          description
a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
i        WORD or /REGEXP/  about anything of above
r        NONE              reinstall recommendations
ls       AUTHOR            about files in the author’s directory

Download, Test, Make, Install…
get                        download
make                       make (implies get)
test      MODULES,         make test (implies make)
install   DISTS, BUNDLES   make install (implies test)
clean                      make clean
look                       open subshell in these dists’ directories
readme                     display these dists’ README files

Other
h,?           display this menu       ! perl-code   eval a perl command
o conf [opt]  set and query options   q             quit the cpan shell
reload cpan   load CPAN.pm again      reload index  load newer indices
autobundle    Snapshot                force cmd     unconditionally do cmd

cpan> force install Scalar::Util
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Sat, 10 Dec 2011 01:31:28 GMT
Running install for module Scalar::Util
Running make for G/GB/GBARR/Scalar-List-Utils-1.23.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for /root/.cpan/sources/authors/id/G/GB/GBARR/Scalar-List-Utils-1.23.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Scalar-List-Utils-1.23/
Scalar-List-Utils-1.23/Changes
Scalar-List-Utils-1.23/lib/
Scalar-List-Utils-1.23/ListUtil.xs
Scalar-List-Utils-1.23/Makefile.PL
Scalar-List-Utils-1.23/MANIFEST
Scalar-List-Utils-1.23/META.yml
Scalar-List-Utils-1.23/multicall.h
Scalar-List-Utils-1.23/README
Scalar-List-Utils-1.23/SIGNATURE
Scalar-List-Utils-1.23/t/
Scalar-List-Utils-1.23/XS.pp
Scalar-List-Utils-1.23/t/00version.t
Scalar-List-Utils-1.23/t/blessed.t
Scalar-List-Utils-1.23/t/dualvar.t
Scalar-List-Utils-1.23/t/expfail.t
Scalar-List-Utils-1.23/t/first.t
Scalar-List-Utils-1.23/t/isvstring.t
Scalar-List-Utils-1.23/t/lln.t
Scalar-List-Utils-1.23/t/max.t
Scalar-List-Utils-1.23/t/maxstr.t
Scalar-List-Utils-1.23/t/min.t
Scalar-List-Utils-1.23/t/minstr.t
Scalar-List-Utils-1.23/t/openhan.t
Scalar-List-Utils-1.23/t/p_00version.t
Scalar-List-Utils-1.23/t/p_blessed.t
Scalar-List-Utils-1.23/t/p_first.t
Scalar-List-Utils-1.23/t/p_lln.t
Scalar-List-Utils-1.23/t/p_max.t
Scalar-List-Utils-1.23/t/p_maxstr.t
Scalar-List-Utils-1.23/t/p_min.t
Scalar-List-Utils-1.23/t/p_minstr.t
Scalar-List-Utils-1.23/t/p_openhan.t
Scalar-List-Utils-1.23/t/p_readonly.t
Scalar-List-Utils-1.23/t/p_reduce.t
Scalar-List-Utils-1.23/t/p_refaddr.t
Scalar-List-Utils-1.23/t/p_reftype.t
Scalar-List-Utils-1.23/t/p_shuffle.t
Scalar-List-Utils-1.23/t/p_sum.t
Scalar-List-Utils-1.23/t/p_tainted.t
Scalar-List-Utils-1.23/t/proto.t
Scalar-List-Utils-1.23/t/readonly.t
Scalar-List-Utils-1.23/t/reduce.t
Scalar-List-Utils-1.23/t/refaddr.t
Scalar-List-Utils-1.23/t/reftype.t
Scalar-List-Utils-1.23/t/shuffle.t
Scalar-List-Utils-1.23/t/stack-corruption.t
Scalar-List-Utils-1.23/t/sum.t
Scalar-List-Utils-1.23/t/tainted.t
Scalar-List-Utils-1.23/t/weak.t
Scalar-List-Utils-1.23/lib/List/
Scalar-List-Utils-1.23/lib/Scalar/
Scalar-List-Utils-1.23/lib/Scalar/Util/
Scalar-List-Utils-1.23/lib/Scalar/Util.pm
Scalar-List-Utils-1.23/lib/Scalar/Util/PP.pm
Scalar-List-Utils-1.23/lib/List/Util/
Scalar-List-Utils-1.23/lib/List/Util.pm
Scalar-List-Utils-1.23/lib/List/Util/PP.pm
/bin/tar: 4608 バイトを – から読み込み
Scalar-List-Utils-1.23/lib/List/Util/XS.pm

  CPAN.pm: Going to build G/GB/GBARR/Scalar-List-Utils-1.23.tar.gz

Checking if your kit is complete…
Looks good
Writing Makefile for List::Util
cp lib/List/Util/XS.pm blib/lib/List/Util/XS.pm
cp lib/Scalar/Util/PP.pm blib/lib/Scalar/Util/PP.pm
cp lib/List/Util/PP.pm blib/lib/List/Util/PP.pm
cp lib/List/Util.pm blib/lib/List/Util.pm
cp lib/Scalar/Util.pm blib/lib/Scalar/Util.pm
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp  -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap  ListUtil.xs > ListUtil.xsc && mv ListUtil.xsc ListUtil.c
gcc -c   -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables   -DVERSION=\"1.23\" -DXS_VERSION=\"1.23\" -fPIC "-I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE"  -DPERL_EXT ListUtil.c
ListUtil.c: In function ‘XS_List__Util_min’:
ListUtil.xs:144: 警告: ‘retval’ may be used uninitialized in this function
Running Mkbootstrap for List::Util ()
chmod 644 Util.bs
rm -f blib/arch/auto/List/Util/Util.so
gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -L/usr/local/lib ListUtil.o  -o blib/arch/auto/List/Util/Util.so        \
                \

chmod 755 blib/arch/auto/List/Util/Util.so
cp Util.bs blib/arch/auto/List/Util/Util.bs
chmod 644 blib/arch/auto/List/Util/Util.bs
Manifying blib/man3/List::Util::XS.3pm
Manifying blib/man3/List::Util.3pm
Manifying blib/man3/Scalar::Util.3pm
  /usr/bin/make  — OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, ‘blib/lib’, ‘blib/arch’)" t/*.t
t/00version………..ok
t/blessed………….ok
t/dualvar………….ok
t/expfail………….ok
t/first……………ok
        2/21 skipped: Poor man’s MULTICALL can’t cope
t/isvstring………..ok
t/lln……………..ok
t/max……………..ok
t/maxstr…………..ok
t/min……………..ok
t/minstr…………..ok
t/openhan………….ok
t/p_00version………ok
t/p_blessed………..ok
t/p_first………….ok
t/p_lln……………ok
t/p_max……………ok
t/p_maxstr…………ok
t/p_min……………ok
t/p_minstr…………ok
t/p_openhan………..ok
t/p_readonly……….ok
t/p_reduce…………ok
t/p_refaddr………..ok
t/p_reftype………..ok
t/p_shuffle………..ok
t/p_sum……………ok
t/p_tainted………..ok
t/proto……………ok
t/readonly…………ok
t/reduce…………..ok
        2/29 skipped: Poor man’s MULTICALL can’t cope
t/refaddr………….ok
t/reftype………….ok
t/shuffle………….ok
t/stack-corruption….ok
t/sum……………..ok
t/tainted………….ok
t/weak…………….ok
All tests successful, 4 subtests skipped.
Files=38, Tests=475,  1 wallclock secs ( 0.94 cusr +  0.21 csys =  1.15 CPU)
  /usr/bin/make test — OK
Running make install
Installing /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/List/Util/Util.so
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Writing /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/List/Util/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
  /usr/bin/make install  — OK

cpan> q
Lockfile removed.
[root@rad-xen-vweb7 ~]#

動くようになりました。

[root@rad-xen-vweb7 ~]#
[root@rad-xen-vweb7 ~]# perl -MScalar::Util=weaken -e 42
[root@rad-xen-vweb7 ~]# perl -MScalar::Util -e ‘print Scalar::Util->VERSION’
1.23[root@rad-xen-vweb7 ~]#

めでたしめでたし。

(Visited 119 times, 1 visits today)

タグ :