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


Can someone save my computer from a dance with a baseball bat?
I am trying to compile XML::LibXML::Common and I'm getting an error creating the make file.
I have libxml2, zlib and iconv installed with the path in my PATH varible (c:\libxml). I am running Windows XP Pro SP2 and ActiveState Perl 5.10

I execute "perl Makefile.pl" from the directory containing XML::LibXML::Common and I get the following error:
C:\TempPerl\XML-LibXML-Common-0.13>perl Makefile.pl enable native perl UTF8 looking for -lxml2... no looking for -llibxml2... 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.
I then try to use the INC and LIBS option from the command line and get the same results.
C:\TempPerl\XML-LibXML-Common-0.13>perl Makefile.pl INC=-Ic:\libxml2\i +nclude LIBS=-Lc:\libxml2\lib enable native perl UTF8 looking for -lxml2... no looking for -llibxml2... 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.
When I run in debug mode I can see that the command line options for LIBS and INC are picked up. Any ideas?

Replies are listed 'Best First'.
Re: Error compiling XML::LibXML::Common
by syphilis (Archbishop) on Jul 02, 2009 at 00:06 UTC
    perl Makefile.pl INC=-Ic:\libxml2\include LIBS=-Lc:\libxml2\lib

    Get rid of the insane Makefile.PL that comes with the distro, and replace it with:
    use ExtUtils::MakeMaker; WriteMakefile( NAME => 'XML::LibXML::Common', VERSION_FROM => 'Common.pm', # finds $VERSION AUTHOR => 'Christian Glahn <christian.glahn@uibk.ac.at>', ABSTRACT => 'Routines and Constants common for XML::LibXML an +d XML::GDOME', LIBS => '-lxml2', );
    Then run perl Makefile.pl INC="-Ic:/libxml2/include" LIBS="-Lc:/libxml2/lib -lxml2"
    Because there's now a space in the LIBS arg, you need to enclose that arg in double quotes. You don't really need double quotes around the INC arg (as it contains no spaces), but I always put them in anyway. Not sure if the backslashes need to be escaped or not - so I just use forward slashes as the path separator to avoid the worry.

    That should now work if you're building against a dynamic library (dll). The dll does, of course, need to be in your path. (I'm finding that the module won't build against a static lib as it expects to find a dll ... and I haven't yet worked out why it has that expectation.)

    Cheers,
    Rob
      If you're editing Makefile.PL, you can do away with commandline overrides
      use ExtUtils::MakeMaker; WriteMakefile( NAME => 'XML::LibXML::Common', VERSION_FROM => 'Common.pm', # finds $VERSION AUTHOR => 'Christian Glahn <christian.glahn@uibk.ac.at>', ABSTRACT => 'Routines and Constants common for XML::LibXML an +d XML::GDOME', INC => "-Ic:/libxml2/include", LIBS => [ "-Lc:/libxml2/lib -lxml2", ], );
        And iff you're building against a static libxml2 library, you need to define -DLIBXML_STATIC. So the Makefile.PL would finally look like:
        use ExtUtils::MakeMaker; WriteMakefile( NAME => 'XML::LibXML::Common', VERSION_FROM => 'Common.pm', # finds $VERSION AUTHOR => 'Christian Glahn <christian.glahn@uibk.ac.at>', ABSTRACT => 'Routines and Constants common for XML::LibXML an +d XML::GDOME', DEFINE => '-DLIBXML_STATIC', INC => "-Ic:/libxml2/include", LIBS => [ "-Lc:/libxml2/lib -lxml2", ], );
        (But leave that DEFINE out if you want to build against a dll.)

        Cheers,
        Rob
Re: Error compiling XML::LibXML::Common
by Anonymous Monk on Jul 01, 2009 at 16:29 UTC
      Thanks for the information but it doesn't seem to work.
      When I execute the ppm command, it can't find an installable package for XML::LibXML::Common.
      C:\TempPerl\XML-LibXML-Common-0.13>ppm install XML::LibXML::Common Downloading ActiveState Package Repository packlist...not modified ppm install failed: Can't find any package that provides XML::LibXML:: +Common C:\TempPerl\XML-LibXML-Common-0.13>

      I have my search sites to be CPAN, 2 sites at Uwinnipeg and Trouchelle.
      If I try to download using a browser I get the following error.
      Content Encoding Error (content_encoding_error) Server response could not be decoded using encoding type returned by s +erver. This is typically caused by a Web Site presenting a content encoding h +eader of one type, and then encoding the data differently.
      Any other leads or recommendations on the Make errors?