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

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念