sdaau
sdaau

Reputation: 38649

How to reinstall: re-run module installation for a failed install in Perl's MCPAN?

I'm tried to install XML::LibXSLT, and it failed:

$ 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

I didn't exit the MCPAN shell; I tried installing sudo apt-get install libxslt1-dev from another terminal, and I wanted to re-run the module installation process. Turns out I can't (I got the clean from perlmonks.org: how to re-run Makefile.PL under CPAN?):

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

Ok, so how do I repeat the installation of this module, now that it failed, and cannot be cleaned either?

Upvotes: 1

Views: 10580

Answers (1)

sdaau
sdaau

Reputation: 38649

Ok, the first thing is to note that there is no (default) way to remove modules from CPAN, failed or not:

That being said, what worked for me was:

  • exit the MCPAN shell
  • enter again via sudo perl -MCPAN -e shell
  • Do not issue install XML::LibXSLT - instead just issue make XML::LibXSLT; note that at this point, I got:
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 
...

Have no idea where these deletions came from.

At this point, the command concluded with:

...
/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

... and after this, for reasons unknown to me, the clean command started responding:

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

... and after doing in another terminal sudo apt-get install libgdbm-dev, and a couple more clean XML::LibXSLT and make XML::LibXSLT, finally got the module to install:

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

Well, hope this helps someone; cheers!

Upvotes: 2

Related Questions