Perl
使用 CPAN 安裝 Perl 模組 XML::Parser 幫助
我正在嘗試使用 CPAN 安裝 XML::Parser perl 模組,但無法正常工作。以下是 CPAN 顯示的輸出,似乎表明 Expat 是問題所在。
安裝這個對我們來說至關重要,我不知道下一步該做什麼。任何幫助將不勝感激!
cpan[1]> install XML::Parser CPAN: Storable loaded ok (v2.21) Going to read '/root/.cpan/Metadata' Database was generated on Fri, 15 Apr 2011 16:29:49 GMT Running install for module 'XML::Parser' Running make for C/CH/CHORNY/XML-Parser-2.40.tar.gz CPAN: Digest::SHA loaded ok (v5.48) CPAN: Compress::Zlib loaded ok (v2.03) Checksum for /root/.cpan/sources/authors/id/C/CH/CHORNY/XML-Parser-2.40.tar.gz ok Scanning cache /root/.cpan/build for sizes ............................................................................DONE CPAN: Archive::Tar loaded ok (v1.68) XML-Parser-2.40 XML-Parser-2.40/Changes XML-Parser-2.40/Makefile.PL XML-Parser-2.40/MANIFEST XML-Parser-2.40/META.yml XML-Parser-2.40/Parser.pm XML-Parser-2.40/README XML-Parser-2.40/Expat XML-Parser-2.40/Expat/encoding.h XML-Parser-2.40/Expat/Expat.pm XML-Parser-2.40/Expat/Expat.xs XML-Parser-2.40/Expat/Makefile.PL XML-Parser-2.40/Expat/typemap XML-Parser-2.40/inc XML-Parser-2.40/inc/Devel XML-Parser-2.40/inc/Devel/CheckLib.pm XML-Parser-2.40/Parser XML-Parser-2.40/Parser/LWPExternEnt.pl XML-Parser-2.40/Parser/Encodings XML-Parser-2.40/Parser/Encodings/big5.enc XML-Parser-2.40/Parser/Encodings/euc-kr.enc XML-Parser-2.40/Parser/Encodings/ibm866.enc XML-Parser-2.40/Parser/Encodings/iso-8859-2.enc XML-Parser-2.40/Parser/Encodings/iso-8859-3.enc XML-Parser-2.40/Parser/Encodings/iso-8859-4.enc XML-Parser-2.40/Parser/Encodings/iso-8859-5.enc XML-Parser-2.40/Parser/Encodings/iso-8859-7.enc XML-Parser-2.40/Parser/Encodings/iso-8859-8.enc XML-Parser-2.40/Parser/Encodings/iso-8859-9.enc XML-Parser-2.40/Parser/Encodings/Japanese_Encodings.msg XML-Parser-2.40/Parser/Encodings/koi8-r.enc XML-Parser-2.40/Parser/Encodings/README XML-Parser-2.40/Parser/Encodings/windows-1250.enc XML-Parser-2.40/Parser/Encodings/windows-1251.enc XML-Parser-2.40/Parser/Encodings/windows-1252.enc XML-Parser-2.40/Parser/Encodings/windows-1255.enc XML-Parser-2.40/Parser/Encodings/x-euc-jp-jisx0221.enc XML-Parser-2.40/Parser/Encodings/x-euc-jp-unicode.enc XML-Parser-2.40/Parser/Encodings/x-sjis-cp932.enc XML-Parser-2.40/Parser/Encodings/x-sjis-jdk117.enc XML-Parser-2.40/Parser/Encodings/x-sjis-jisx0221.enc XML-Parser-2.40/Parser/Encodings/x-sjis-unicode.enc XML-Parser-2.40/Parser/Style XML-Parser-2.40/Parser/Style/Debug.pm XML-Parser-2.40/Parser/Style/Objects.pm XML-Parser-2.40/Parser/Style/Stream.pm XML-Parser-2.40/Parser/Style/Subs.pm XML-Parser-2.40/Parser/Style/Tree.pm XML-Parser-2.40/samples XML-Parser-2.40/samples/canonical XML-Parser-2.40/samples/canontst.xml XML-Parser-2.40/samples/ctest.dtd XML-Parser-2.40/samples/REC-xml-19980210.xml XML-Parser-2.40/samples/xmlcomments XML-Parser-2.40/samples/xmlfilter XML-Parser-2.40/samples/xmlstats XML-Parser-2.40/t XML-Parser-2.40/t/astress.t XML-Parser-2.40/t/cdata.t XML-Parser-2.40/t/decl.t XML-Parser-2.40/t/defaulted.t XML-Parser-2.40/t/encoding.t XML-Parser-2.40/t/ext.ent XML-Parser-2.40/t/ext2.ent XML-Parser-2.40/t/external_ent.t XML-Parser-2.40/t/file.t XML-Parser-2.40/t/finish.t XML-Parser-2.40/t/foo.dtd XML-Parser-2.40/t/namespaces.t XML-Parser-2.40/t/parament.t XML-Parser-2.40/t/partial.t XML-Parser-2.40/t/skip.t XML-Parser-2.40/t/stream.t /bin/tar: Read 3072 bytes from - XML-Parser-2.40/t/styles.t CPAN: File::Temp loaded ok (v0.22) CPAN: Parse::CPAN::Meta loaded ok (v1.40) CPAN.pm: Going to build C/CH/CHORNY/XML-Parser-2.40.tar.gz 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. Or you can download expat from: http://sourceforge.net/projects/expat/ If expat is installed, but in a non-standard directory, then use the following options to Makefile.PL: EXPATLIBPATH=... To set the directory in which to find libexpat EXPATINCPATH=... To set the directory in which to find expat.h For example: perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include Note that if you build against a shareable library in a non-standard location you may (on some platforms) also have to set your LD_LIBRARY_PATH environment variable at run time for perl to find the library. Checking if your kit is complete... Looks good Writing Makefile for XML::Parser::Expat Writing Makefile for XML::Parser Could not read metadata file. Falling back to other methods to determine prerequisites cp Parser/Encodings/x-sjis-cp932.enc blib/lib/XML/Parser/Encodings/x-sjis-cp932.enc cp Parser/Encodings/koi8-r.enc blib/lib/XML/Parser/Encodings/koi8-r.enc cp Parser/Encodings/iso-8859-7.enc blib/lib/XML/Parser/Encodings/iso-8859-7.enc cp Parser/Encodings/ibm866.enc blib/lib/XML/Parser/Encodings/ibm866.enc cp Parser/Style/Tree.pm blib/lib/XML/Parser/Style/Tree.pm cp Parser/Encodings/iso-8859-9.enc blib/lib/XML/Parser/Encodings/iso-8859-9.enc cp Parser/Encodings/x-euc-jp-unicode.enc blib/lib/XML/Parser/Encodings/x-euc-jp-unicode.enc cp Parser/Encodings/README blib/lib/XML/Parser/Encodings/README cp Parser/Encodings/euc-kr.enc blib/lib/XML/Parser/Encodings/euc-kr.enc cp Parser/Encodings/windows-1250.enc blib/lib/XML/Parser/Encodings/windows-1250.enc cp Parser/Encodings/windows-1252.enc blib/lib/XML/Parser/Encodings/windows-1252.enc cp Parser/Encodings/big5.enc blib/lib/XML/Parser/Encodings/big5.enc cp Parser/Encodings/windows-1255.enc blib/lib/XML/Parser/Encodings/windows-1255.enc cp Parser/Encodings/iso-8859-3.enc blib/lib/XML/Parser/Encodings/iso-8859-3.enc cp Parser/Encodings/Japanese_Encodings.msg blib/lib/XML/Parser/Encodings/Japanese_Encodings.msg cp Parser/Encodings/x-euc-jp-jisx0221.enc blib/lib/XML/Parser/Encodings/x-euc-jp-jisx0221.enc cp Parser/Style/Subs.pm blib/lib/XML/Parser/Style/Subs.pm cp Parser/Encodings/iso-8859-8.enc blib/lib/XML/Parser/Encodings/iso-8859-8.enc cp Parser/Encodings/iso-8859-4.enc blib/lib/XML/Parser/Encodings/iso-8859-4.enc cp Parser/Encodings/x-sjis-jdk117.enc blib/lib/XML/Parser/Encodings/x-sjis-jdk117.enc cp Parser/Encodings/iso-8859-2.enc blib/lib/XML/Parser/Encodings/iso-8859-2.enc cp Parser/Encodings/x-sjis-unicode.enc blib/lib/XML/Parser/Encodings/x-sjis-unicode.enc cp Parser/LWPExternEnt.pl blib/lib/XML/Parser/LWPExternEnt.pl cp Parser/Style/Objects.pm blib/lib/XML/Parser/Style/Objects.pm cp Parser.pm blib/lib/XML/Parser.pm cp Parser/Style/Debug.pm blib/lib/XML/Parser/Style/Debug.pm cp Parser/Encodings/windows-1251.enc blib/lib/XML/Parser/Encodings/windows-1251.enc cp Parser/Encodings/x-sjis-jisx0221.enc blib/lib/XML/Parser/Encodings/x-sjis-jisx0221.enc cp Parser/Style/Stream.pm blib/lib/XML/Parser/Style/Stream.pm cp Parser/Encodings/iso-8859-5.enc blib/lib/XML/Parser/Encodings/iso-8859-5.enc make[1]: Entering directory `/root/.cpan/build/XML-Parser-2.40-xNvsuv/Expat' cp Expat.pm ../blib/lib/XML/Parser/Expat.pm /usr/bin/perl /usr/share/perl5/ExtUtils/xsubpp -noprototypes -typemap /usr/share/perl5/ExtUtils/typemap -typemap typemap Expat.xs > Expat.xsc && mv Expat.xsc Expat.c gcc -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -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=\"2.40\" -DXS_VERSION=\"2.40\" -fPIC "-I/usr/lib/perl5/CORE" Expat.c 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: 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’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:512: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:530: error: ‘CallbackVector’ has no member named ‘nstab’ Expat.xs:530: error: ‘CallbackVector’ has no member named ‘nslst’ Expat.xs:539: error: ‘CallbackVector’ has no member named ‘start_sv’ Expat.xs:545: error: ‘CallbackVector’ has no member named ‘context’ Expat.xs:547: error: ‘CallbackVector’ has no member named ‘ns’ Expat.xs:548: error: ‘CallbackVector’ has no member named ‘new_prefix_list’ Expat.xs:485: warning: unused variable ‘pnslst’ Expat.xs:484: warning: unused variable ‘pnstab’ Expat.xs:481: warning: unused variable ‘pcontext’ Expat.xs: In function ‘endElement’: Expat.xs:559: error: ‘CallbackVector’ has no member named ‘context’ Expat.xs:561: error: ‘CallbackVector’ has no member named ‘st_serial_stackptr’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘skip_until’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:565: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:575: error: ‘CallbackVector’ has no member named ‘end_sv’ Expat.xs:581: error: ‘CallbackVector’ has no member named ‘st_serial_stackptr’ Expat.xs: In function ‘processingInstruction’: Expat.xs:601: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs: In function ‘commenthandle’: Expat.xs:621: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs: In function ‘startCdata’: Expat.xs:633: error: ‘CallbackVector’ has no member named ‘startcd_sv’ Expat.xs:640: error: ‘CallbackVector’ has no member named ‘startcd_sv’ Expat.xs: In function ‘endCdata’: Expat.xs:653: error: ‘CallbackVector’ has no member named ‘endcd_sv’ Expat.xs:660: error: ‘CallbackVector’ has no member named ‘endcd_sv’ Expat.xs: At top level: Expat.xs:668: warning: type defaults to ‘int’ in declaration of ‘XML_Char’ Expat.xs:668: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token Expat.xs:688: warning: type defaults to ‘int’ in declaration of ‘XML_Char’ Expat.xs:688: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token Expat.xs: In function ‘defaulthandle’: Expat.xs:720: error: ‘CallbackVector’ has no member named ‘dflt_sv’ Expat.xs: At top level: Expat.xs:729: error: expected declaration specifiers or ‘...’ before ‘XML_Content’ Expat.xs: In function ‘elementDecl’: Expat.xs:738: warning: implicit declaration of function ‘generate_model’ Expat.xs:738: error: ‘model’ undeclared (first use in this function) Expat.xs:738: error: (Each undeclared identifier is reported only once Expat.xs:738: error: for each function it appears in.) Expat.xs:738: warning: assignment makes pointer from integer without a cast Expat.xs:747: error: ‘CallbackVector’ has no member named ‘eledcl_sv’ Expat.xs: In function ‘attributeDecl’: Expat.xs:785: error: ‘CallbackVector’ has no member named ‘attdcl_sv’ Expat.xs: In function ‘entityDecl’: Expat.xs:818: error: ‘CallbackVector’ has no member named ‘entdcl_sv’ Expat.xs: In function ‘doctypeStart’: Expat.xs:844: error: ‘CallbackVector’ has no member named ‘doctyp_sv’ Expat.xs: In function ‘doctypeEnd’: Expat.xs:861: error: ‘CallbackVector’ has no member named ‘doctypfin_sv’ Expat.xs: In function ‘xmlDecl’: Expat.xs:887: error: ‘CallbackVector’ has no member named ‘xmldec_sv’ Expat.xs: In function ‘unparsedEntityDecl’: Expat.xs:915: error: ‘CallbackVector’ has no member named ‘unprsd_sv’ Expat.xs: In function ‘notationDecl’: Expat.xs:956: error: ‘CallbackVector’ has no member named ‘notation_sv’ Expat.xs: At top level: Expat.xs:960: error: expected ‘)’ before ‘parser’ Expat.xs:1115: error: expected declaration specifiers or ‘...’ before ‘XML_Encoding’ Expat.xs: In function ‘unknownEncoding’: Expat.xs:1146: warning: unused variable ‘count’ Expat.xs:1167: error: ‘info’ undeclared (first use in this function) Expat.xs: In function ‘recString’: Expat.xs:1187: error: ‘CallbackVector’ has no member named ‘recstring’ Expat.xs:1188: error: ‘CallbackVector’ has no member named ‘recstring’ Expat.xs:1191: error: ‘CallbackVector’ has no member named ‘recstring’ Expat.xs: In function ‘suspend_callbacks’: Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1197: error: ‘CallbackVector’ has no member named ‘char_sv’ Expat.xs:1198: warning: implicit declaration of function ‘XML_SetCharacterDataHandler’ Expat.xs:1198: error: ‘CallbackVector’ has no member named ‘p’ Expat.xs:1199: error: ‘XML_CharacterDataHandler’ undeclared (first use in this function) Expat.xs:1199: error: expected ‘)’ before numeric constant Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1202: error: ‘CallbackVector’ has no member named ‘proc_sv’ Expat.xs:1203: warning: implicit declaration of function ‘XML_SetProcessingInstructionHandler’ Expat.xs:1203: error: ‘CallbackVector’ has no member named ‘p’ Expat.xs:1204: error: ‘XML_ProcessingInstructionHandler’ undeclared (first use in this function) Expat.xs:1204: error: expected ‘)’ before numeric constant Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ Expat.xs:1207: error: ‘CallbackVector’ has no member named ‘cmnt_sv’ make[1]: *** [Expat.o] Error 1 make[1]: Leaving directory `/root/.cpan/build/XML-Parser-2.40-xNvsuv/Expat' make: *** [subdirs] Error 2 CHORNY/XML-Parser-2.40.tar.gz /usr/bin/make -- NOT OK CPAN: YAML loaded ok (v0.72) Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible Failed during this command: CHORNY/XML-Parser-2.40.tar.gz : make NO
您可能缺少 expat dev 包。
在 Debian 或 Ubuntu 上,只需鍵入:
apt-get update apt-get install libexpat1-dev
在 RedHat 或 CentOS 上,鍵入:
yum install expat-devel
希望這可以幫助!
對我來說合乎邏輯的是嘗試:
百勝安裝 expat-devel