20

Here is the stdout for install:

$sudo cpanm XML::LibXML
--> Working on XML::LibXML
Fetching http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0014.tar.gz ... OK
Configuring XML-LibXML-2.0014 ... N/A
! Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.

details:

Unpacking XML-LibXML-2.0014.tar.gz
Entering XML-LibXML-2.0014
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.55_02)
Configuring XML-LibXML-2.0014
Running Makefile.PL
enable native perl UTF8
running xml2-config...ok (2.9.0)
Checking for ability to link against xml2...no
Checking for ability to link against libxml2...libxml2, zlib, and/or the 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.
-> N/A
-> FAIL Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.

i tried installing libxml2 manually, but still getting the same issue.

also, i checked for libxml2-dev:

 sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 78 not upgraded.

here is the system info:

 lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 11.04
Release:    11.04
Codename:   natty

uname -a Linux autobot 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

mvp
  • 111,019
  • 13
  • 122
  • 148
kamal
  • 9,637
  • 30
  • 101
  • 168

4 Answers4

35

I think the relevant line is:

Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.

So, you've covered off libxml. Have you installed the appropriate zlib package? Try:

sudo apt-get install zlib1g-dev

Then try installing XML::LibXML again.

oalders
  • 5,239
  • 2
  • 23
  • 34
  • 10
    Just noting that I ran into the same issue recently where `libxml2` and `zlib1g-dev` were installed. Needed also to install `libxml2-dev` for this to work. – Jon Cram Feb 14 '14 at 10:57
  • 1
    @JonCram Thanks for the advice! I am using Ubuntu 12.04, and perl version 5.14. I had the same problem, and was not able to install `XML::LibXML` with `cpan` until I installed `libxml2-dev`.. – Håkon Hægland May 18 '14 at 11:06
26

Why do you want to use CPAN for this anyway? It is typically very bad idea to install CPAN packages if you have native packages provided by standard operating system installer.

Ubuntu provides a lot of Perl packages natively, with following naming convention: package name always starts with lib, then Perl package name like XML::LibXML is converted to lower case and :: replaced to dash - (XML::LibXML => xml-libxml), and finally -perl suffix is added. In other words, native package name for XML::LibXML would be libxml-libxml-perl.

So, in your case, you simply run this command and it will pull all necessary dependencies automatically:

sudo apt-get install libxml-libxml-perl

If you don't like this package for any reason you can uninstall it with sudo apt-get remove. If you use CPAN, it is very difficult to uninstall it reliably.

mvp
  • 111,019
  • 13
  • 122
  • 148
  • 2
    perhaps installing the module for something other than the system perl – ysth Dec 20 '12 at 06:11
  • 5
    In general, for the system perl you should definately use packages as much as possible. If you compiled your own perl, using cpan is the way to go. – MichielB Dec 20 '12 at 07:11
  • >`Why do you want to use CPAN for this anyway?` because of installing module into Carton environment/Perlbrew – Eugen Konkov May 31 '18 at 12:06
  • @EugenKonkov: in that case, you're not using Perl provided by the OS. Its quite simple, actually - if you use system Perl, you should NOT use cpan to add other modules, only use OS provided packages. If you use custom Perl, you should use cpan. – mvp Jun 01 '18 at 17:50
4

Overlooked the obvious:

sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev

then:

sudo cpanm XML::LibXML

works!

kamal
  • 9,637
  • 30
  • 101
  • 168
1

Maybe this is new version. I did:

sudo apt-get install libxml2-dev

After this module builded and installed successfully

Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158