【问题标题】:How to reinstall: re-run module installation for a failed install in Perl's MCPAN?如何重新安装:在 Perl 的 MCPAN 中安装失败时重新运行模块安装?
【发布时间】:2015-02-12 18:06:47
【问题描述】:

我尝试安装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

好的,那么我该如何重复安装这个模块,既然它失败了,也无法清理呢?

【问题讨论】:

    标签: perl cpan


    【解决方案1】:

    好的,首先要注意的是,没有(默认)方法可以从 CPAN 中删除模块,无论是否失败:

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

    • 退出 MCPAN 外壳
    • 通过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
    

    好吧,希望这对某人有所帮助;干杯!

    【讨论】:

    • 这些删除是因为您在 .cpan 中的“构建缓存”已超出大小限制,正在整理中。
    • 似乎比清晰更神奇。我有同样的问题,无法解决。
    • 它对我有用,使用 Win32::File 。谢谢!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-14
    相关资源
    最近更新 更多