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

I'm running on RHEL 6.9. I have installed libxml2 and libxml2-devel. The xml2 libraries are under /usr/lib64. Zlib is installed and is under /lib64. So, I changed makepl_arg as:

o conf makepl_arg "INC=-I/usr/include -I/usr/local/include -I/usr/incl +ude/libxml2/libxml LIBS=-L/usr/lib64 -L/usr/lib -L/usr/local/lib -L/l +ib64 -llibxml2 -lm" o conf commit
When I run cpan XML::LibXML::Node, I get:
... 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.
I'm not sure what math library it is referring to. I have been searching on the Internet, but nothing is really popping out. Any clues what I may be missing?

Replies are listed 'Best First'.
Re: cpan install error for XML::LibXML::Node
by Corion (Patriarch) on May 31, 2017 at 11:51 UTC

    The easy approach is to run Makefile.PL yourself:

    cpan cpan> look XML::LibXML /path/to/build/dir/for/XML-LibXML-123.456> perl Makefile.PL INC=... LI +BS=... /path/to/build/dir/for/XML-LibXML-123.456> make /path/to/build/dir/for/XML-LibXML-123.456> make test

    Hopefully you see more output of which library the Makefile.PL run is missing. If the Makefile.PL is not verbose enough, consider adding print statements to it to see what it does and which libraries it tests for.

      I added DEBUG=1 to the line. It is complaining about not being able to find all of the headers under /usr/include/libxml2/libxml. I included that with '-I.' So, not sure why it can't find them? I checked and all of the files and the path down have world readability. Does the order of the includes matter?

Re: cpan install error for XML::LibXML::Node
by hippo (Archbishop) on May 31, 2017 at 12:44 UTC
    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"

    The penultimate term looks wrong. Surely it should be -lxml2 instead?

      I tried that and get the same results. I'm not an experienced compiler. I'm assuming the '-l' is just passed to gcc? The libxml2 library is:

      /usr/lib64/libxml2.so.2.7.6 /usr/lib64/libxml2.so.2 -> libxml2.so.2.7.6

      that is why I used libxml2. Maybe I should make it libxml2.so.2?

        Nope, definitely -lxml2.

        $ xml2-config --libs -lxml2 -lz -lm
Re: cpan install error for XML::LibXML::Node
by stevieb (Canon) on May 31, 2017 at 12:14 UTC

    It is referring to the standard C math library. I doubt this is what is actually causing the issue, but you can verify this specifically if what Corion said doesn't lead you to the root problem.

    Create a basic C file:

    // test.c #include <math.h> int main (){ return 0; }

    Then compile it:

    gcc test.c -lm

    If you don't get errors (which I highly expect you won't), the problem is due to finding the libxml libraries and you'll have to focus there.

      yes, the compile worked without complaint. I see the math header under /usr/include as part of the glibc-headers rpm. Thanks! Will take a shot at the 'look' method.