Can't locate LibXML.pm

本文解决了一个在Ubuntu环境下使用CPAN安装XML::LibXML时遇到的问题,通过直接使用apt-get安装libxml-libxml-perl解决了依赖库无法找到的问题。
手机开发过程中,需要运行高通的一个脚本 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
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上找到了解决方法

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

引用\[1\]: 服务器操作系统为centos 7,配置lcov显示单元测试覆盖率 lcov需要与gcov配合使用作为其前端工具,gcov在安装gcc工具时已经集成,lcov需要命令行安装 yum install lcov 。引用\[2\]: 安装的过程中报错。 Error: unsupported compiler: 7.5.0. Use --override to override this check. =========== = Summary = =========== Driver: Not Selected Toolkit: Installation Failed. Using unsupported Compiler. Samples: Not Selected 解决方法 安装时使用以下命令,还是报错。 sudo sh cuda_8.0.27_linux.run --override 报错内容 Can't locate InstallUtils.pm in @INC (you may need to install the InstallUtils module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./install-linux.pl line 6. BEGIN failed--compilation aborted at ./install-linux.pl line 6. 参考Can’t locate InstallUtils.pm in @INC解决,具体方法如下。 ./cuda*.run --tar mxvf cp InstallUtils.pm /usr/lib/x86_64-linux-gnu/perl-base export $PERL5LIB sudo sh cuda_8.0.27_linux.run --override。引用\[3\]: 2.下载编译安装perl wget www.cpan.org/src/5.0/perl-5.30.0.tar.gz tar -zxvf perl-5.30.0.tar.gz ./Configure -des -Dprefix=/usr/local/perl #进入解压目录 make make test make install 。问题: Can't locate lcovutil.pm 回答: 出现 "Can't locate lcovutil.pm" 错误是因为系统无法找到 lcovutil.pm 文件。要解决这个问题,您可以尝试以下步骤: 1. 确保您已经正确安装了 lcov。您可以使用命令 "yum install lcov" 来安装 lcov。 2. 检查 lcovutil.pm 文件是否存在于正确的路径中。您可以使用命令 "find / -name lcovutil.pm" 来查找该文件。如果找到了该文件,请确保它在 Perl 的 @INC 路径中。 3. 如果 lcovutil.pm 文件不存在于系统中,您可以尝试重新安装 lcov 或者手动下载 lcovutil.pm 文件并将其放置在正确的路径中。 请注意,具体的解决方法可能因系统配置和安装环境而有所不同。如果以上方法无法解决问题,建议您参考 lcov 的官方文档或者在相关的技术论坛上寻求帮助。 #### 引用[.reference_title] - *1* *3* [【lcov单元测试覆盖率报错:Can’t locate IO/Uncompress/Gunzip.pm in @INC】](https://blog.csdn.net/weixin_46115865/article/details/124104264)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [ubuntu18.04 安装cuda8.0遇到Can‘t locate InstallUtils.pm的问题](https://blog.csdn.net/xiaoyang19910623/article/details/108407959)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值