in reply to Error compiling XML::LibXML::Common

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

Replies are listed 'Best First'.
Re^2: Error compiling XML::LibXML::Common
by Anonymous Monk on Jul 02, 2009 at 00:51 UTC
    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