in reply to Re^6: cpan install error for XML::LibXML::Node
in thread cpan install error for XML::LibXML::Node

Here's a very short sample showing correct compilation against libxml2 on CentOS 6:

$ wget http://www.xmlsoft.org/examples/io2.c --2017-05-31 15:13:18-- http://www.xmlsoft.org/examples/io2.c Resolving www.xmlsoft.org... 91.121.203.120 Connecting to www.xmlsoft.org|91.121.203.120|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1182 (1.2K) [text/plain] Saving to: `io2.c' 100%[======================================>] 1,182 --.-K/s in + 0s 2017-05-31 15:13:18 (53.9 MB/s) - `io2.c' saved [1182/1182] $ gcc -o xmltest -I/usr/include/libxml2 -lxml2 -lz -lm io2.c $ ./xmltest <?xml version="1.0"?> <root>content</root> $

If you get the same then the problem is likely to be on the cpan side. But if you get something different then it isn't a perl problem at all and you'll need to fix your libxml2 installation.

Replies are listed 'Best First'.
Re^8: cpan install error for XML::LibXML::Node
by BradV (Sexton) on Jun 01, 2017 at 13:37 UTC

    I didn't compile libxml2. I got it from Red Hat rpms.

    libxml2-2.7.6-21.el6_8.1.x86_64 libxml2-devel-2.7.6-21.el6_8.1.x86_64

    Just figured it out! I think this is a bug in the Makefile.PL. I added some print statements as suggested and ran it. It seems the makefile was only looking at the first '-I' and not all of them. I had '-I/usr/include/libxml2' as the third one. When I moved it to first, it ran successfully!

    Thanks to everyone for their help! :)

      It seems the makefile was only looking at the first '-I' and not all of them

      Possibly an issue with your quoting (or lack thereof).
      When giving multiple '-I' args to Makefile.PL's INC, you need to enclose them in double quotes:
      perl Makefile.PL INC="-I/first/location -I/second/location"
      But if there's only one '-I' then you can do away with the double quotes.

      Cheers,
      Rob

        Ah! I had:

        o conf makepl_arg "INC=-I/usr/include -I/usr/local/include -I/usr/include/libxml2/libxml LIBS=-L/usr/lib64 -L/usr/lib -L/usr/local/lib -L/lib64 -llibxml2 -lm"

        I should probably have used:

        o conf makepl_arg 'INC="-I/usr/include -I/usr/local/include -I/usr/include/libxml2/libxml" LIBS="-L/usr/lib64 -L/usr/lib -L/usr/local/lib -L/lib64" -llibxml2 -lm'

        Thanks for the help! :)