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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章