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

hello again all,

I'm in the process of installing XML::LibXML. The gnome libxml library installed without a hitch. But when I go to run Makefile.PL for the module, it says it can't find the xml2 library:

]$ perl Makefile.PL PREFIX=/big/dom/xclickautomation/bin/perl + running xml2-config... ok looking for -lxml2... no libxml2 not found Try setting LIBS and INC values on the command line Or get 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.

Of course it can't find it. Neither can I.

I've searched through all avaialable directories for xml2* with no luck. Does anyone here have any insight as to why I might be missing this library and what I can do to correct my situation?

Replies are listed 'Best First'.
XML::LibXML installation woes cured
by AidanLee (Chaplain) on Dec 20, 2001 at 02:43 UTC

    Well, for posterity's sake, here's what I've found so far. I believe I have reached the end of this saga, but we'll see.

    First after mirod pointed me to the perl-xml mailing list as the place of discussion for all things XML::LibXML, I found a post from the author that said this in response to the same exact problem I was having:

    The stuff I wrote for checking that you can link to libraries doesn't seemt to work on Debian. Just comment out the check for -lxml2 and it'll work.

    So I did that (though I do not know if this web host is running Debian). I ran make and discovered something was telling Makefile.PL to use 'pgcc' as my compiler. I've never heard of this compiler, nor, it appears, had my server. I dutiously added CC='gcc' to my command line, which now (for those keeping score) looked like:

    perl Makefile.PL PREFIX=/big/dom/xclickautomation/bin/perl LIBS='-L/big/dom/xclickautomation/lib' INC='-I/big/dom/xclickautomation/include/libxml2' CC='gcc'

    Rerunning make, I discovered that this did not override all instances of pgcc. I hand-edited Makefile to correct a line under the 'MakeMaker tools_other section'. Finally make ran as it should.

    'make test' cropped up that some of the tests apparently wanted to use Devel::Peek. It would have been good to know this in the Prerequisites section of the Makefile.PL, but I suppose that tests aren't really part of the module itself. I probably would have skipped 'make test' except that this installation had already given me so much grief.

Re: XML::LibXML installation woes (or, whence that library file?)
by Zaxo (Archbishop) on Dec 20, 2001 at 00:30 UTC

    A utility called xml2-config is ordinarily installed with libxml2. It is used to provide linker flags and the like. Is it present and in the $PATH in your installation? I believe that XML::LibXML uses that.

    You don't say what kind of system you're on, but you may need to tell the .so loader about your new libs. Glibc systems use ldconfig, Solaris LD_LIBRARY_PATH, which also works for glibc ld.so. Your nonstandard PREFIX suggests that you are installing in a user directory which won't be on the compiler's include path or the linker's normal library path.

    After Compline,
    Zaxo

      Good diagnosis. I'm installing on a web host who runs a heavily modified (or so i'm told) Linux 2.2 kernel. I found xml2-config without any problems, and set my path to include the local bin directory i had created.

      I've found the same files lestrrat located on his machine. I've tried setting the LIBS directive on the Makefile.PL command line to reflect this (broken into multiple lines for clarity only):

      perl Makefile.PL PREFIX=/big/dom/xclickautomation/bin/perl LIBS='-L/big/dom/xclickautomation/lib' INC='-I/big/dom/xclickautomation/include'

      but it still can't seem to find what it's looking for. I'd note that it seems to be searching for a library called 'xml2' not 'libxml2'. I even tried changing this in the Makefile.PL to 'libxml2' but it still claimed it couldn't find it. I also set LD_LIBRARY_PATH to point to the local lib directory, although running on Linux may make that moot.

      I searched through the libxml mailing list archives without turning up anything even remotely related to this problem (though it doesn't sound like a libxml problem, but rather an XML::LibXML install issue.) I haven't found any mention of a XML::LibXML mailing list either. Has anyone heard of one?

        I searched through the libxml mailing list archives without turning up anything even remotely related to this problem (though it doesn't sound like a libxml problem, but rather an XML::LibXML install issue.) I haven't found any mention of a XML::LibXML mailing list either. Has anyone heard of one?

        XML::libXML is discussed on the perl-xml mailing list.

Re: XML::LibXML installation woes (or, whence that library file?)
by lestrrat (Deacon) on Dec 19, 2001 at 22:59 UTC

    You want to check out xmlsoft.org. I don't think libxml/libxslt comes standard with any linux distribution... yet

    By the way I had to go into the code and fix a few things when I installed libxml/libxslt ( I forget which ) on my RedHat 7.1 a while back

      I just installed the most recent version of libxml myself. As to needing to fix things in the source, my C is incredibly rusty and I wouldn't know where to look to fix the above mentioned problem (seemingly absent library)

        Well, not much I can do without having access to your machine, but have you tried using "find" ? I forget off hand what the library name was, but your could do something like find / -name <libraryname> to see if the library files were properly installed.

        As for the C fix, if libxml still needed it, then the installation wouldn't have worked... if it did work for you, then I guess the problem was fixed.

        Sorry for not being too helpful. It was a while back that I installed libxml, and I don't have my machine handy with me at this point

        UPDATE: I think these are the files... you might just want to add wherever these files are installed in your LD_LIBRARY_PATH environment variable when you try to install XML::LibXML

        me@myhost me> ls /usr/local/lib
        libexslt.a         libxml2.a         libxslt.a         perl5
        libexslt.la        libxml2.la        libxslt.la        pkgconfig
        libexslt.so        libxml2.so        libxslt.so        xml2Conf.sh
        libexslt.so.0      libxml2.so.2      libxslt.so.1      xsltConf.sh
        libexslt.so.0.6.0  libxml2.so.2.4.7  libxslt.so.1.0.6
        me@myhost me>