首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在Ubuntu上安装XML::LibXML

如何在Ubuntu上安装XML::LibXML
EN

Stack Overflow用户
提问于 2012-12-20 12:05:42
回答 4查看 38.2K关注 0票数 20

下面是用于安装的stdout:

代码语言:javascript
复制
$sudo cpanm XML::LibXML
--> Working on XML::LibXML
Fetching http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0014.tar.gz ... OK
Configuring XML-LibXML-2.0014 ... N/A
! Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.

详细信息:

代码语言:javascript
复制
Unpacking XML-LibXML-2.0014.tar.gz
Entering XML-LibXML-2.0014
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.55_02)
Configuring XML-LibXML-2.0014
Running Makefile.PL
enable native perl UTF8
running xml2-config...ok (2.9.0)
Checking for ability to link against xml2...no
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.
Try setting LIBS and INC values on the command line
Or get libxml2 from
  http://xmlsoft.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.

Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter
to see the exact reason why the detection of libxml2 installation
failed or why Makefile.PL was not able to compile a test program.
-> N/A
-> FAIL Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.

我尝试手动安装libxml2,但仍然遇到同样的问题。

此外,我还检查了libxml2-dev:

代码语言:javascript
复制
 sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 78 not upgraded.

以下是系统信息:

代码语言:javascript
复制
 lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.04
Release:    11.04
Codename:   natty

uname -a Linux autobot 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011 x86_64 GNU/Linux

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2012-12-20 12:34:22

我认为相关的线条是:

代码语言:javascript
复制
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.

所以,您已经覆盖了libxml。您是否安装了相应的zlib包?尝试:

代码语言:javascript
复制
sudo apt-get install zlib1g-dev

然后再次尝试安装XML::LibXML。

票数 35
EN

Stack Overflow用户

发布于 2012-12-20 13:12:19

你为什么要使用CPAN来完成这个任务呢?如果您有由标准操作系统安装程序提供的本机包,那么安装CPAN包通常是非常糟糕的主意。

Ubuntu原生提供了许多Perl包,命名约定如下:包名始终以lib开头,然后将XML::LibXML等Perl包名转换为小写,将::替换为破折号- (XML::LibXML => xml-libxml),最后添加-perl后缀。换句话说,XML::LibXML的本机包名称将是libxml-libxml-perl

因此,在您的示例中,您只需运行此命令,它将自动提取所有必要的依赖项:

代码语言:javascript
复制
sudo apt-get install libxml-libxml-perl

如果你因为任何原因不喜欢这个包,你可以用sudo apt-get remove卸载它。如果您使用CPAN,则很难可靠地卸载它。

票数 26
EN

Stack Overflow用户

发布于 2012-12-20 12:33:44

忽略了显而易见的事实:

代码语言:javascript
复制
sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev

然后:

代码语言:javascript
复制
sudo cpanm XML::LibXML

成功了!

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13965140

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档