G-chan Square

じーちゃん/へたっぴの綴る、日々のつれづれとか。
twitterのまとめとゲームネタが中心。2015年からロードバイク/ミニベロ始めました。

[perl] cpanでXMLRPC::Liteを入れるのにややハマり

超絶久しぶりの技術ネタ
さて、諸処諸々の都合でperlのXMLRPC::Liteというモジュールを使いたいのだけど、じーちゃんの環境には残念ながらこれが入っていない。

んじゃ、まぁ、入れてやりますか……ってことで、
# cpan -i XMLRPC::Lite
とかやったら、壮大にmake testでコケてinstallできなかった。。
(省略)
t/SOAP/Transport/POP3.t ...................... ok
t/XML/Parser/Lite.t .......................... 1/38 Subroutine XML::Parser::Lite::_parse_re redefined at /root/.cpan/build/SOAP-Lite-0.712-C_511M/blib/lib/XML/Parser/Lite.pm line 143.
t/XML/Parser/Lite.t .......................... ok
t/XMLRPC/Lite.t .............................. ok
Test Summary Report
-------------------
t/SOAP/Transport/HTTP/CGI.t                (Wstat: 512 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
Files=35, Tests=868,  2 wallclock secs ( 0.24 usr  0.04 sys +  1.52 cusr  0.50 csys =  2.30 CPU)
Result: FAIL
Failed 1/35 test programs. 2/868 subtests failed.
make: *** [test_dynamic] Error 255
  MKUTTER/SOAP-Lite-0.712.tar.gz
one dependency not OK (XML::Parser); additionally test harness failed
  /usr/bin/make test -- NOT OK
  reports MKUTTER/SOAP-Lite-0.712.tar.gz
Failed during this command:
 TODDR/XML-Parser-2.41.tar.gz                 : make NO
 MKUTTER/SOAP-Lite-0.712.tar.gz               : make_test NO one dependency not OK (XML::Parser); additionally test harness failed
依存関係が多すぎてエラーやテストも全部書いてられないんだけど、結局の所は依存関係の一つSOAP::Liteでしくじっている様子。
確かに、
[root@xen Parser]# cpan
cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.
cpan[1]> test SOAP::Lite
とかやっても同じエラーが出る。

でも ”Subroutine XML::Parser::Lite::_parse_re redefined at /root/.cpan/build/SOAP-Lite-0.712-C_511M/blib/lib/XML/Parser/Lite.pm line 143. ”とか言われても知らんがな……
一応、該当のファイルの中も見てみたのだけど……これをいじってなんか解決する気配がない。。

で、あれこれ、触っていたら……実はSOAP::Liteは無実だったらしいことが発覚w

SOAP::Liteを入れる過程でXML::Parserってのも入れようとするんだけど、実はこっちのほうが壮大にコケていた。
Expat.xs:12:19: error: expat.h: No such file or directory
Expat.xs:60: error: expected specifier-qualifier-list before ‘XML_Parser’
Expat.xs:111: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘nsdelim’
Expat.xs:194: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ms’
Expat.xs:197: error: expected ‘)’ before ‘parser’
Expat.xs:249: error: expected ‘)’ before ‘*’ token
Expat.xs:286: error: expected ‘)’ before ‘parser’
Expat.xs: In function ‘characterData’:
Expat.xs:470: error: ‘CallbackVector’ has no member named ‘char_sv’
Expat.xs: In function ‘startElement’:
Expat.xs:482: error: ‘CallbackVector’ has no member named ‘ns’
Expat.xs:488: error: ‘CallbackVector’ has no member named ‘st_serial’
Expat.xs:490: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.xs:491: error: ‘CallbackVector’ has no member named ‘st_serial’
Expat.xs:491: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.xs:494: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.xs:498: error: ‘CallbackVector’ has no member named ‘st_serial_stackptr’
Expat.xs:498: error: ‘CallbackVector’ has no member named ‘st_serial_stacksize’
Expat.xs:499: error: ‘CallbackVector’ has no member named ‘st_serial_stacksize’
Expat.xs:501: error: ‘CallbackVector’ has no member named ‘st_serial_stack’
Expat.xs:501: warning: comparison is always false due to limited range of data type
Expat.xs:501: error: ‘CallbackVector’ has no member named ‘st_serial_stack’
Expat.xs:502: error: ‘CallbackVector’ has no member named ‘st_serial_stacksize’
Expat.xs:505: error: ‘CallbackVector’ has no member named ‘st_serial_stack’
Expat.xs:505: error: ‘CallbackVector’ has no member named ‘st_serial_stackptr’
Expat.xs:505: error: ‘CallbackVector’ has no member named ‘st_serial’
Expat.xs:508: error: ‘CallbackVector’ has no member named ‘nstab’
Expat.xs:508: error: ‘CallbackVector’ has no member named ‘nslst’
Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’
大量に出ていたerror群。でも、エラーの内容見てもよくわからないなぁ(´・ω・`)……とか思っていたんだけど、エラーの先頭を見ると”Expat.xs:12:19: error: expat.h: No such file or directory”とか書かれているではありませんか!

しかも
Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager. See 'README'.
とか、ちゃんと出力されていたw

要するに、Expat.xsをコンパイルするときに、/usr/includeにexpat.hを見るので、それがなければならないらしい。

ってことで早速入れてやる。
# yum install expat-devel
をやった後で
# cpan -i XMLRPC::Lite
をやってみたら……今度はあっさりと成功! インストール完了したらしい。

教訓:面倒くさくてもエラーメッセージは注意深くよく見ること

コメントする