Link to home
Start Free TrialLog in
Avatar of jetbet
jetbetFlag for New Zealand

asked on

Getting LibXML2 and perl XML::LibXML working on Windows XP

I want to add the following the XML::LibXML perl package to a Windows XP VMWare Virtual Machine.
My perl version is ActivePerl-5.8.8.822.
I have both PPM and CPAN available on the command line.
I have installed the package via CPAN but it will not build due to LibXML2 not being found.
I have been to http://xmlsoft.org/ to get instructions and downloaded the windows binarys from http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/" and tried to install them.

I have added LibXML2.dll to my system32 folder.
I have created a folder called c:\toolkit, added everything from the bin directory to it and added this to by path variable.
I have called install with LIBS and INC set to my toolkit directory from the CPAN command line.

Although the installation process complained about not being able to find xml2 and libxml2 the LibXML package is installed in my perl\site\lib\XML directory. When I try to run a perl scriprt that was working on an old Windows NT VM (I am upgrading to Windows XP but keeping the same scripts) it complains about XML::LibXML::Common.pm not being there.

Installing this by hand gets me the following message;
****************************************************************************************
"Can't locate loadable object for module XML::LibXML::Common in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/site/lib/XML/"
******************************************************************************************

Trying to install Common via CPAN gives me the following error
****************************************************************************************
  CPAN.pm: Going to build P/PH/PHISH/XML-LibXML-Common-0.13.tar.gz

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.
Warning: No success on command[C:\Perl\bin\perl.exe Makefile.PL]
Warning (usually harmless): 'YAML' not installed, will not store persistent state
  PHISH/XML-LibXML-Common-0.13.tar.gz
  C:\Perl\bin\perl.exe Makefile.PL -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
Failed during this command:
 PHISH/XML-LibXML-Common-0.13.tar.gz          : writemakefile NO 'C:\Perl\bin\perl.exe Makefile.PL' returned status 512
*******************************************************************************************************************

I have tried downloading NMake and running that, I have looked inside the CPAN perl scripts for what search paths are being used......

Nothing seems to work.

Does anyone know how to get Perl modules with dependencies like this working in windows?
 Everything I have tried seems to point at being on a *nix machine or being a C programmer.

Thanks  
ASKER CERTIFIED SOLUTION
Avatar of mjcoyne
mjcoyne

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of clockwatcher
clockwatcher

Not for points but the commands to do what mcjoyne is suggesting:

   ppm repo add http://theoryx5.uwinnipeg.ca/ppms

   ppm install XML-LibXML


It looks like this:

C:\Documents and Settings\Mark>ppm repo add http://theoryx5.uwinnipeg.ca/ppms
Downloading theoryx5.uwinnipeg.ca packlist...done
Updating theoryx5.uwinnipeg.ca database...done
Repo 3 added.

C:\Documents and Settings\Mark>ppm install XML-LibXML
Downloading XML-LibXML-1.63...done
Downloading XML-SAX-0.16...done
Downloading XML-NamespaceSupport-1.09...done
Downloading XML-LibXML-Common-0.13...done
Unpacking XML-LibXML-1.63...done
Unpacking XML-SAX-0.16...done
Unpacking XML-NamespaceSupport-1.09...done
Unpacking XML-LibXML-Common-0.13...done
Generating HTML for XML-LibXML-1.63...done
Generating HTML for XML-SAX-0.16...done
Generating HTML for XML-NamespaceSupport-1.09...done
Generating HTML for XML-LibXML-Common-0.13...done
Updating files in site area...done
Downloading XML-LibXML-Common-0.13 install script...done
Running XML-LibXML-Common-0.13 install script...
The library libxml2.dll is needed to complete the installation,
and should be placed in a directory somewhere in your PATH
environment variable. I can fetch and install this for you,
if you don't already have it.

Fetch libxml2.dll? [yes]
Fetching http://theoryx5.uwinnipeg.ca/ppms/scripts/libxml2.dll ...  done!
Where should libxml2.dll be placed? [C:\Perl\bin]
libxml2.dll has been successfully installed to C:/Perl/bin
done
Downloading XML-LibXML-1.63 install script...done
Running XML-LibXML-1.63 install script...
Do you want to alter ParserDetails.ini? [yes]
C:\Perl\bin\perl.exe -MXML::SAX -e "XML::SAX->add_parser(q(XML::LibXML::SAX::Par
ser))->save_parsers()"
C:\Perl\bin\perl.exe -MXML::SAX -e "XML::SAX->add_parser(q(XML::LibXML::SAX))->s
ave_parsers()"
done
 103 files installed
Or you can just do:

C:\>ppm install http://theoryx5.uwinnipeg.ca/ppms/XML-LibXML

if you don't feel like adding the U Winnipeg repository to your list, but it is a very good repository for Windows PPMs, along with the Bribes repository (http://www.bribes.org/perl/ppm) and the Roth Consulting repository (http://www.roth.net/perl/packages/).  I always add all three to all my Windows machines.
Avatar of jetbet

ASKER

Great,
I had been to the site but not added it to my repository and so did not realise it was available from there. The only package I had found there was LibXML-Perl. When I tried using that I had an error that it was still looking for LibXML as it appeared to ignore the '-' and everything after it.

PPM is a lot more freindly than CPAN by the looks of it as it downloaded the prerequisites as well.

The perl module is now loading fine and all I need to do is find out how to get rid of the perl.exe error box with the error
"The procedure entry point xmlCtxGetLastError could not be located in the dynamic link library libxml2.dll"

Do you have any idea, I am quite happy to start from scratch with my install if I have screwed something up with my previous attempts at install.
Avatar of jetbet

ASKER

I will try reinstalling perl from scratch.
I get the following error when I close the error box;

Can't load 'C:/Perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML: load_file:The specified procedure could not be found at C:/
Perl/lib/DynaLoader.pm line 229.
 at C:/Perl/site/lib/XML/LibXML.pm line 116
BEGIN failed--compilation aborted at C:/Perl/site/lib/XML/LibXML.pm line 116.
Compilation failed in require at C:\TestFramework\trunk\jeriServer.pl line 7.
BEGIN failed--compilation aborted at C:\TestFramework\trunk\jeriServer.pl line 7.

Thanks for all your help