Can't locate XML/LibXML.pm in @INC

转自:http://blog.csdn.net/winva/article/details/50722303


sudo apt-get install libxml2-dev zlib1g-dev 



手机开发过程中,需要运行高通的一个脚本parser.pl,但是这个脚本依赖一个LibXML的库,怎么都装不上去。



$ sw/device/qcom/common/display/tools$ perl parser.pl panel_nt35596_1080p_video.xml panel
Can't locate XML/LibXML.pm in @INC (you may need to install the XML::LibXML module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at parser.pl line 29.
BEGIN failed--compilation aborted at parser.pl line 29.


$ sw/device/qcom/common/display/tools$ sudo cpan install XML::LibXML
Reading '/home/xxx/.cpan/Metadata'
  Database was generated on Tue, 12 Jan 2016 17:53:37 GMT
Running install for module 'XML::LibXML'
Running make for S/SH/SHLOMIF/XML-LibXML-2.0123.tar.gz
Checksum for /home/xxx/.cpan/sources/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0123.tar.gz ok


  CPAN.pm: Building S/SH/SHLOMIF/XML-LibXML-2.0123.tar.gz


enable native perl UTF8
running xml2-config...didn't manage to get libxml2 config, guessing
options:
  LIBS='-L/usr/local/lib -L/usr/lib -lxml2 -lm'
  INC='-I/usr/local/include -I/usr/include'
If this is wrong, Re-run as:
  $ /usr/bin/perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/include'


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.
No 'Makefile' created  SHLOMIF/XML-LibXML-2.0123.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites


但是我确实是安装了libxml2了
$ sw/device/qcom/common/display/tools$ dpkg -l |grep libxml2
ii  libxml2:amd64                                         2.9.1+dfsg1-3ubuntu4.6                              amd64        GNOME XML library
ii  libxml2:i386                                          2.9.1+dfsg1-3ubuntu4.6                              i386         GNOME XML library
ii  libxml2-utils                                         2.9.1+dfsg1-3ubuntu4.6                              amd64        XML utilities
虽然装上了libxml2,但是cpan install XML::LibXML时找不到。


最终在StackOverFlow上找到了解决方法


http://stackoverflow.com/questions/13965140/how-can-i-install-xmllibxml-on-ubuntu-11-04
Why do you want to use CPAN for this anyway? It is typically very bad idea to install CPAN packages if you have native packages provided by standard operating system installer.


Ubuntu provides a lot of Perl packages natively, with following naming convention: package name always starts with lib, then Perl package name like XML::LibXML is converted to lower case and :: replaced to dash - (XML::LibXML => xml-libxml), and finally -perl suffix is added. In other words, native package name for XML::LibXML would be libxml-libxml-perl.


So, in your case, you simply run this command and it will pull all necessary dependencies automatically:


Ubuntu提供了一系列的经过转化的Perl包,我们可以通过apt-get而不是cpan的方式安装这些包。
这些包盒cpan的包的名字是这样转换的:大写字母全部换成小写,符号::换成-。例如:XML::LibXML转换成libxml-libxml-perl。


$ sudo apt-get install libxml-libxml-perl


If you don't like this package for any reason you can uninstall it with sudo apt-get remove. If you use CPAN, it is very difficult to uninstall it reliably.


$ dpkg -l |grep libxml2
ii  libxml-libxml-perl                                    2.0108+dfsg-1ubuntu0.1                              amd64        Perl interface to the libxml2 library
无法定位到extutils/makemaker.pm在@inc中(@inc包含。。。 这个错误通常出现在使用Perl模块时,Perl无法找到所需的"Makemaker"模块所在的路径。Makemaker模块是用于编译和安装Perl模块的工具。 要解决这个问题,可以尝试以下几种解决方法: 1. 检查模块是否已安装:首先,确保你已经正确安装了所需的模块。如果你还没有安装该模块,可以使用CPAN(Comprehensive Perl Archive Network)来安装它,或者使用适合操作系统的包管理器来安装。 2. 更新Perl版本:如果你的Perl版本较旧,可能会导致某些模块不可用。尝试通过更新Perl版本来解决这个问题。可以通过命令行执行"perl -v"来查看当前的Perl版本,然后根据操作系统的要求更新它。 3. 设置PERL5LIB环境变量:有时,Perl无法找到所需的模块路径是因为PERL5LIB环境变量没有设置正确。在命令行中执行以下命令来设置PERL5LIB环境变量: Unix/Linux系统:export PERL5LIB=/path/to/your/lib Windows系统:set PERL5LIB=C:\path\to\your\lib 请将"/path/to/your/lib"替换为实际的模块路径。 4. 检查@INC路径:@INC是一个Perl内置的数组,用于存储包含可执行文件的目录列表。在遇到这个错误时,可以使用命令行执行以下命令来查看@INC路径: perl -E 'say foreach @INC' 确保包含了正确的模块路径。如果没有,可以通过以下方法在代码中添加路径: Unix/Linux系统:在脚本中添加如下语句:use lib '/path/to/your/lib'; Windows系统:在脚本中添加如下语句:use lib 'C:\path\to\your\lib'; 请将"/path/to/your/lib"替换为实际的模块路径。 通过以上解决方法,你应该能够解决无法定位到extutils/makemaker.pm的问题,并使Perl能够正确找到所需的模块。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值