2008/7/3 yumしたら、perlでトラブル

提供: ServerSettings
移動先: 案内検索

原因

perlのリビジョンがあがったから

現象

cronで動作させている、awstatsの集計スクリプトが、実行できない。

# /etc/cron.hourly/awstats.cron

Can't locate Jcode.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /usr/local/src/awstats/wwwroot/cgi-bin/utf8_decode.pl line 8.
BEGIN failed--compilation aborted at /usr/local/src/awstats/wwwroot/cgi-bin/utf8_decode.pl line 8

utf8_decode.plの8行目には、こんなことが書いてある。

use Jcode;

Jcodeがどこにあるのか探してみる

$ locate Jcode
:
:
/usr/lib/perl5/site_perl/5.8.8/Jcode
/usr/lib/perl5/site_perl/5.8.8/Jcode.pm
/usr/lib/perl5/site_perl/5.8.8/Jcode/Nihongo.pod
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Jcode
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Jcode/.packlist
:
:

今まで、perlのバージョンが、5.8.8から、yumで5.10.0になった模様。


対処

Jcodeを再インストール。


# perl -MCPAN -e shell

Sorry, we have to rerun the configuration dialog for CPAN.pm due to
some missing parameters...

Normally CPAN.pm keeps config variables in memory and changes need to
be saved in a separate 'o conf commit' command to make them permanent
between sessions. If you set the 'auto_commit' option to true, changes
to a config variable are always automatically committed to disk.

 <auto_commit>
Always commit changes to config variables to disk? [no]

A Build.PL is run by perl in a separate process. Likewise we run
'./Build' and './Build install' in separate processes. If you have any
parameters you want to pass to the calls, please specify them here.

Typical frequently used settings:

    --install_base /home/xxx             # different installation directory

 <mbuildpl_arg>
Parameters for the 'perl Build.PL' command? []

Parameters for the './Build' command? Setting might be:

    --extra_linker_flags -L/usr/foo/lib  # non-standard library location

 <mbuild_arg>
Your choice: []

Do you want to use a different command for './Build install'? Sudo
users will probably prefer:

    su root -c ./Build
 or
    sudo ./Build
 or
    /path1/to/sudo -u admin_account ./Build

 <mbuild_install_build_command>
or some such. Your choice: [./Build]

Parameters for the './Build install' command? Typical frequently used
setting:

    --uninst 1                           # uninstall conflicting files

 <mbuild_install_arg>
Your choice: []



Please remember to call 'o conf commit' to make the config permanent!

Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> install Jcode
CPAN: Storable loaded ok (v2.18)
Going to read /home/ryo/.cpan/Metadata
  Database was generated on Thu, 03 Jul 2008 07:02:54 GMT
Running install for module 'Jcode'
Running make for D/DA/DANKOGAI/Jcode-2.07.tar.gz

  CPAN: checksum security checks disabled because Digest::SHA not installed.
  Please consider installing the Digest::SHA module.

CPAN: Time::HiRes loaded ok (v1.9711)
Scanning cache /home/ryo/.cpan/build for sizes
............................................................................DONE
CPAN: Compress::Zlib loaded ok (v2.008)
Jcode-2.07/
Jcode-2.07/Changes
Jcode-2.07/Changes.ver0X
Jcode-2.07/Jcode/
Jcode-2.07/Jcode/_Classic.pm
Jcode-2.07/Jcode/Constants.pm
Jcode-2.07/Jcode/H2Z.pm
Jcode-2.07/Jcode/Nihongo.pod
Jcode-2.07/Jcode/Tr.pm
Jcode-2.07/Jcode/Unicode/
Jcode-2.07/Jcode/Unicode/Constants.pm
Jcode-2.07/Jcode/Unicode/NoXS.pm
Jcode-2.07/Jcode.pm
Jcode-2.07/Makefile.PL
Jcode-2.07/MANIFEST
Jcode-2.07/META.yml
Jcode-2.07/README
Jcode-2.07/t/
Jcode-2.07/t/_test_unicode.pl
Jcode-2.07/t/ambiguous.pl
Jcode-2.07/t/append.t
Jcode-2.07/t/benchmark.pl
Jcode-2.07/t/convert.t
Jcode-2.07/t/fun.pl
Jcode-2.07/t/getcode.t
Jcode-2.07/t/h2z.t
Jcode-2.07/t/hankaku.euc
Jcode-2.07/t/hiragana.euc
Jcode-2.07/t/jfold.t
Jcode-2.07/t/length.t
Jcode-2.07/t/mime.t
Jcode-2.07/t/new.t
Jcode-2.07/t/perl581.t
Jcode-2.07/t/regex.t
Jcode-2.07/t/stripped.euc
Jcode-2.07/t/table.euc
Jcode-2.07/t/table.jis
Jcode-2.07/t/table.sjis
Jcode-2.07/t/table.ucs2
Jcode-2.07/t/table.utf8
Jcode-2.07/t/tr.t
Jcode-2.07/t/unibench.pl
Jcode-2.07/t/x0212.euc
Jcode-2.07/t/x0212.jis
Jcode-2.07/t/x0212.ucs2
Jcode-2.07/t/x0212.utf8
Jcode-2.07/t/zenkaku.euc
Jcode-2.07/Unicode/
Jcode-2.07/Unicode/euc2uni.h
Jcode-2.07/Unicode/Makefile.PL
Jcode-2.07/Unicode/uni.c
Jcode-2.07/Unicode/uni2euc.h
Jcode-2.07/Unicode/Unicode.pm
Jcode-2.07/Unicode/Unicode.xs
CPAN: File::Temp loaded ok (v0.18)

  CPAN.pm: Going to build D/DA/DANKOGAI/Jcode-2.07.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Jcode
Could not read '/home/ryo/.cpan/build/Jcode-2.07-taCuNm/META.yml'. Falling back to other methods to determine prerequisites
cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
cp Jcode.pm blib/lib/Jcode.pm
Manifying blib/man3/Jcode::Nihongo.3pm
Manifying blib/man3/Jcode.3pm
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make -- OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/append.....ok
t/convert....ok
t/getcode....ok
t/h2z........ok
t/jfold......ok
t/length.....ok
t/mime.......ok
t/new........ok
t/perl581....ok
t/regex......ok
t/tr.........ok
All tests successful.
Files=11, Tests=244,  7 wallclock secs ( 4.38 cusr +  0.26 csys =  4.64 CPU)
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make test -- OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state
Running make install
Prepending /home/ryo/.cpan/build/Jcode-2.07-taCuNm/blib/arch /home/ryo/.cpan/build/Jcode-2.07-taCuNm/blib/lib to PERL5LIB for 'install'
Installing /usr/local/lib/perl5/site_perl/5.10.0/Jcode.pm
Installing /usr/local/lib/perl5/site_perl/5.10.0/Jcode/Nihongo.pod
Installing /usr/local/share/man/man3/Jcode.3pm
Installing /usr/local/share/man/man3/Jcode::Nihongo.3pm
Writing /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi/auto/Jcode/.packlist
Appending installation info to /usr/lib/perl5/5.10.0/i386-linux-thread-multi/perllocal.pod
  DANKOGAI/Jcode-2.07.tar.gz
  /usr/bin/make install  -- OK
Warning (usually harmless): 'YAML' not installed, will not store persistent state

cpan[2]> exit
Terminal does not support GetHistory.
Lockfile removed.

結果

問題なく集計できるようになった。

後日談

Jcodeは、fedoraのパッケージの一つとしてちゃんと用意されている。 yumでインストールしておけば、こんな問題、発生しないと思う。

# yum install -y perl-Jcode.noarch
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package perl-Jcode.noarch 0:2.06-6.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 perl-Jcode              noarch     2.06-6.fc9       fedora             30 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 30 k
Downloading Packages:
(1/1): perl-Jcode-2.06-6.fc9.noarch.rpm                                                          |  30 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-Jcode                                        [1/1]

Installed: perl-Jcode.noarch 0:2.06-6.fc9
Complete!