Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I guess I haven't installed enough non-pure-Perl modules, but I can't figure this out. Here's what I'm seeing:
[root@localhost ~]# cpan make XML::LibXML CPAN: Term::ANSIColor loaded ok (v4.02) CPAN: Storable loaded ok (v2.34) Reading '/root/.cpan/Metadata' Database was generated on Thu, 06 Mar 2014 11:17:02 GMT Don't be silly, you can't install Matthias Kerk ;-) CPAN: Time::HiRes loaded ok (v1.9725) Running install for module 'XML::LibXML' Running make for S/SH/SHLOMIF/XML-LibXML-2.0111.tar.gz CPAN: Digest::SHA loaded ok (v5.84) CPAN: Compress::Zlib loaded ok (v2.06) Checksum for /root/.cpan/sources/authors/id/S/SH/SHLOMIF/XML-LibXML-2. +0111.tar.gz ok CPAN: Archive::Tar loaded ok (v1.90) ... CPAN: File::Temp loaded ok (v0.22) CPAN: Parse::CPAN::Meta loaded ok (v1.4404) CPAN: CPAN::Meta loaded ok (v2.120921) CPAN: Module::CoreList loaded ok (v2.80) CPAN.pm: Building S/SH/SHLOMIF/XML-LibXML-2.0111.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: $ /opt/ActivePerl-5.16/bin/perl-static 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 t +he Math library (-lm) have not been found. Try setting LIBS and INC values on the command line Or get libxml2 from http://xmlsoft.org/ 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' createdCPAN: YAML::XS loaded ok (v0.39) SHLOMIF/XML-LibXML-2.0111.tar.gz /opt/ActivePerl-5.16/bin/perl-static 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 determi +ne prerequisites
It looks like the LIBS is looking for xml2 not libxml2; only the latter is installed on my system.
[root@localhost ~]# find / -name 'xml2.so*' [root@localhost ~]# find / -name 'libxml2.so*' /usr/lib64/libxml2.so.2.6.26 /usr/lib64/libxml2.so.2 /usr/lib/libxml2.so.2.6.26 /usr/lib/libxml2.so.2 [root@localhost ~]#
Is there some way to override the value of LIBS from the cpan command line? Or do I need to figure out where to run the suggested 'perl-static Makefile.PL' command? Or is there something else I'm missing? Thanks!

Replies are listed 'Best First'.
Re: can't install XML::LibXML under ActivePerl
by Corion (Patriarch) on Mar 07, 2014 at 07:28 UTC

    It seems you are installing modules into your system Perl. This is highly unadvisable as it may leave your system Perl in a state where your system tools cannot use it anymore. I highly recommend using your OS package manager to install modules into your system Perl.

    If a module needs additional configuration input, I recommend a semi-manual installation:

    cpan cpan> look XML::LibXML ... perl Makefile.PL LIBS=/usr/lib64 INC=... make make test make install

      Thanks for the "cpan look" command. It's hard to believe, but in 25 years of Perl usage, this is the first time I've needed to use it.

      FYI, my OS package manager only installs Perl 5.8; I'm installing 5.16 into /opt.