XML::Parser Could not make: Unknown error

| No Comments

  尝试通过cpan shell 安装XML::Parser时遇到Could not make: Unknown error错误。

cpan[1]> install XML::Parser
Running install for module 'XML::Parser'
Running make for T/TO/TODDR/XML-Parser-2.41.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/XML-Parser-2.41-gOllU7
Could not make: Unknown error
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

  cpan shell 安装perl模块的时候常有无法安装的情况,进入XML::Parser源码目录,尝试过手动编译安装:

[root@qcloud-vps ~]#cd  /root/.cpan/build/XML-Parser-2.41-gOllU7
[root@qcloud-vps XML-Parser-2.41-gOllU7]# perl ./Makefile.PL 

Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager. See 'README'.

Or you can download expat from:

http://sourceforge.net/projects/expat/

If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:

    EXPATLIBPATH=...  To set the directory in which to find libexpat

    EXPATINCPATH=...  To set the directory in which to find expat.h

For example:

    perl Makefile.PL EXPATLIBPATH=/home/me/lib EXPATINCPATH=/home/me/include

Note that if you build against a shareable library in a non-standard location
you may (on some platforms) also have to set your LD_LIBRARY_PATH environment
variable at run time for perl to find the library.

Generating a Unix-style Makefile
Writing Makefile for XML::Parser::Expat
Writing MYMETA.yml and MYMETA.json
Generating a Unix-style Makefile
Writing Makefile for XML::Parser
Writing MYMETA.yml and MYMETA.json

  还是失败,仔细看看上面的提示:Install 'expat-devel' package with your OS package manager. See 'README'. 原来是缺expat-devel包。安装expat-devel后就可以安装XML::Parser了。

[root@qcloud-vps XML-Parser-2.41-gOllU7]# yum install expat-devel
[root@qcloud-vps XML-Parser-2.41-gOllU7]# make clean
[root@qcloud-vps XML-Parser-2.41-gOllU7]# perl ./Makefile.PL
[root@qcloud-vps XML-Parser-2.41-gOllU7]# make && make install

本文结束。

Leave a comment