如何在没有expat-devel的情况下安装XML :: Parser?

Alo*_*dal 13 perl debian cpan expat-parser

XML :: Parser无法在一个非常新的64位Debian盒子上构建.发布后cpan XML::Parser,cpan因Expat.c和Expat.xs出现大量错误而失败:

[...]
Expat.xs:2182: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.c: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.c:2904: error: ‘XML_Parser’ undeclared (first use in this function)
Expat.c:2904: error: expected ‘;’ before ‘parser’
Expat.xs:2194: error: ‘parser’ undeclared (first use in this function)
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/root/.cpan/build/XML-Parser-2.41-rpV6ok/Expat'
make: *** [subdirs] Error 2
  TODDR/XML-Parser-2.41.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Run Code Online (Sandbox Code Playgroud)

输出开头的消息说明构建需要expat-devel.

必须在构建XML :: Parser之前安装Expat,我在标准库目录中找不到它.使用OS包管理器安装'expat-devel'包.请参阅"自述文件".

expat-devel不在Debian存储库中.

是否可以克服这个问题而无需从源代码构建/安装expat?

Seb*_*mpf 43

您要安装的软件包已命名libexpat1-dev.你也可以libxml-parser-perl通过apt-get 安装.或者,如果您真的想通过CPAN安装,请先尝试安装Debian软件包依赖项apt-get build-dep libxml-parser-perl.


Alo*_*dal 9

libexpat1-dev包含libexpat和expat.h,它们也在消息中提到:

如果安装了expat,但是在非标准目录中,则使用以下选项来Makefile.PL:

EXPATLIBPATH = ...设置查找libexpat的目录

EXPATINCPATH = ...设置查找expat.h的目录

安装libexpat1-dev似乎解决了这个问题:

$ aptitude install libexpat1-dev
Run Code Online (Sandbox Code Playgroud)


小智 5

总是有手动方法 - 从源代码构建/安装expat.(此示例显示安装到XAMPP | LAMPP的备用位置)

下载地址:http: //sourceforge.net/projects/expat/files/expat/

tar zxf /[where-ever]/expat-2.1.0.tar.gz -C /tmp
cd /tmp/expat-2.1.0
/opt/lampp/bin/perl ./configure --prefix=/opt/lampp LDFLAGS=-L/opt/lampp/lib 
make
make install
Run Code Online (Sandbox Code Playgroud)

http://search.cpan.org - 搜索和下载 - XML :: Parser

tar zxf /[where-ever]/XML-Parser-2.41.tar.gz -C /tmp
cd /tmp/XML-Parser-2.41
/opt/lampp/bin/perl ./Makefile.PL EXPATLIBPATH=/opt/lampp/lib EXPATINCPATH=/opt/lampp/include
make
make test
make install
Run Code Online (Sandbox Code Playgroud)