如何重新安装:为Perl的MCPAN中的安装失败重新运行模块安装?

时间:2015-02-12 09:38:37

标签: perl cpan

我尝试安装XML::LibXSLT,但失败了:

$ sudo perl -MCPAN -e shell
...
cpan[9]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
...
Configuring S/SH/SHLOMIF/XML-LibXSLT-1.94.tar.gz with Makefile.PL
running xslt-config... failed
using fallback values for LIBS and INC
options:
  LIBS='-L/usr/local/lib -L/usr/lib -lxslt -lxml2 -lz -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'

looking for -lxslt... no
libxslt not found
Try setting LIBS and INC values on the command line
Or get libxslt and libxml2 from
  http://www.libxml.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
No 'Makefile' created  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Failed during this command:
 SHLOMIF/XML-LibXSLT-1.94.tar.gz              : writemakefile NO -- No 'Makefile' created

我没有退出MCPAN shell;我尝试从另一个终端安装sudo apt-get install libxslt1-dev,我想重新运行模块安装过程。结果我不能(我从perlmonks.org: how to re-run Makefile.PL under CPAN?得到clean):

cpan[10]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/XML-LibXSLT-1.94-2qijzZ
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  No 'Makefile' created
, not re-running

cpan[11]> clean XML::LibXSLT
Running clean for module 'XML::LibXSLT'
Running make clean
No Makefile, don't know how to 'make clean'

cpan[13]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/XML-LibXSLT-1.94-2qijzZ
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  No 'Makefile' created
, not re-running

好的,那么如何重复安装此模块,现在它已经失败了,也无法清理?

1 个答案:

答案 0 :(得分:1)

好的,首先要注意的是,没有(默认)方式从CPAN中移除模块,失败与否:

话虽如此,对我有用的是:

  • 退出MCPAN shell
  • 通过sudo perl -MCPAN -e shell
  • 再次输入
  • 不要发出install XML::LibXSLT - 而只是发出make XML::LibXSLT;请注意,此时,我得到了:
cpan[1]> make XML::LibXSLT
CPAN: Storable loaded ok (v2.30)
Reading '/root/.cpan/Metadata'
  Database was generated on Thu, 12 Feb 2015 08:41:02 GMT
Running make for module 'XML::LibXSLT'
... 
Scanning cache /root/.cpan/build for sizes
................................................----------------------------DONE
DEL(1/122): /root/.cpan/build/JSON-DWIW-0.47-ppRqJq 
CPAN: YAML loaded ok (v0.73)
DEL(2/122): /root/.cpan/build/JSON-DWIW-0.47-ppRqJq.yml 
DEL(3/122): /root/.cpan/build/common-sense-3.4-bfJ9E8 
...

不知道这些删除的来源。

此时,命令结束于:

...
/usr/bin/ld: cannot find -lgdbm
/usr/bin/ld: cannot find -lgdbm_compat
collect2: ld returned 1 exit status
...
Failed during this command:
 SHLOMIF/XML-LibXSLT-1.94.tar.gz              : make NO

cpan[2]> make XML::LibXSLT
Running make for module 'XML::LibXSLT'
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/XML-LibXSLT-1.94-4kLOVB
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  Has already been prepared
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  Could not make: Unknown error

...之后,由于我不知道的原因,clean命令开始响应:

cpan[4]> clean XML::LibXSLT
Running clean for module 'XML::LibXSLT'
Running make clean
rm -f \
      *.a core \
      core.[0-9] blib/arch/auto/XML/LibXSLT/extralibs.all \
...
mv Makefile Makefile.old > /dev/null 2>&1
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  /usr/bin/make clean -- OK

...在另一个终端sudo apt-get install libgdbm-dev和另外两个clean XML::LibXSLTmake XML::LibXSLT之后,最后得到了要安装的模块:

cpan[8]> notest install XML::LibXSLT
Running install for module 'XML::LibXSLT'
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
...
Installing /usr/local/man/man3/XML::LibXSLT.3pm
Appending installation info to /usr/lib/perl/5.10/perllocal.pod
  SHLOMIF/XML-LibXSLT-1.94.tar.gz
  /usr/bin/make install  -- OK

嗯,希望这有助于某人;干杯!