How I got XML-LibXSLT v1.70 to work on my machine

Posted by winstonjenks on 2011-02-21 22:31
Forums: PPM | OS: Windows

Frustrated that XML-LibXML is at version 1.70 which is incompatible with the latest version on the ActiveState Perl 5.8 repository of XML-LibXSLT, I tried to build 1.70 of XML-LibXSLT myself. I got it to work on my machine, but could not create the proper .ppd/.zip combination for a PPM install. I compiled the package with VC6 and Perl 5.8.9

1) Go to CPAN and download the XML-LibXSLT 1.70 package. http://search.cpan.org/CPAN/authors/id/P/PA/PAJAS/XML-LibXSLT-1.70.tar.gz Unpack that to any old place where you keep your C projects.

2) Go to ftp://xmlsoft.org/libxml2/win32/ and download the following files:
iconv-1.9.2.win32.zip
libxml2-2.7.8.win32.zip
libxslt-1.1.26.win32.zip
zlib-1.2.5.win32.zip
Unzip these files into a temporary location. Each one has a bin,include, and lib directory. Take the contents of the include directory for each .zip file (it might be files, it might be directories) and place those items in your %INCLUDE% path for your compiler or in C:\RandomIncludeDir. Place the contents of each of the lib directories in a directory known to your %LIB% as well. If you are using VC6, run VCVARS32.BAT to set up your environment variables. If you put the files in some random directory, then you can do something like:
SET INCLUDE=%INCLUDE%;C:\RandomIncludeDir
SET LIB=%LIB%;C:\RandomLibDir
This essentially adds those paths to your include and library paths. You can also monkey with the Makefile.PL, but doing it this way requires less knowledge, and decrease the chance of breaking something in the Makefile.PL file.

3) AFTER you have your INCLUDE and LIB vars adjusted, IN THE SAME COMMAND PROMPT go to the directory where you unpacked the XML-LibXSLT-1.70 and do:
perl Makefile.PL
nmake
That should build your module for you.

4) To install it on your system, do:
nmake install
Now you have to worry about getting the right .DLL files in the path. Remember the bin directory that came out of the four .zip files above? Grab the following .DLLs from those directories and put them in your PATH. Maybe C:\Perl\bin for example.
libxml2.dll
libexslt.dll
libxslt.dll
zlib1.dll
iconv.dll
Now here is where things get a little fuzzy. The Makefile talks about the LibXSLT.dll being a problem, so it was renamed to LibXSLT.xs.DLL. Indeed on my system, that is the name of the .DLL in the \perl\site\lib\auto\XML\LibXSLT directory. And that is the file that tries to get autoloaded when the module is "Use"d. But I had to move a couple of DLLs around and I did not write down what I did, but got it to work in the end.

I did have a problem with the XSLT module complaining about the version of the libxml2.dll being 206 instead of 207. This manifests itself at run-time when the module gets "Use"d. I updated the libxml2.dll from the 2-2.7.8 zip file and then it got happy again.

5) Then I did a
nmake ppd
nmake zipdist

I do not have tar or gzip on my machine, but I do have the command line tool for WinZip. I needed to adjust the Makefile (after it was built) to modify the ZIP= and ZIPFLAGS= lines to:
ZIP = "C:\Program Files\WinZip\WZZIP.exe"
ZIPFLAGS = -r -P

Note that the -P is case sensitive. Use the little -p and you'll wonder why your .zip file has only some of the files.

It always bugs me that you have to fill in the in the .ppd file to put the name of the zip file in the quotes. I am pretty sure the .ppd file needs some of the magic that prompts you to download the .dll and stick it in C:\Perl\bin, but I don't know how to do that either.

It seems to me that the XML-LibXML and XML-LibXSLT should really come as a matched set, since the XSLT uses the libxml2.dll library as well.

So if I can do it, surely the ActiveState Repository dude who knows how all this stuff works can do it too, right?

winstonjenks | Tue, 2011-02-22 22:35

I have the PPM package built. The .PPD and .ZIP file. But what I don't know is how to structure the .ppd file so it will automatically download and install the required .dll files like the XML-LibXML package does.

Does someone have a place to put it? If so, let me know and I'll send it to you. Here are the results of the test.
C:\MsDev\Projects\XML-LibXSLT-1.70>nmake test

Microsoft (R) Program Maintenance Utility Version 6.00.9782.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bl
ib\lib', 'blib\arch')" t/*.t
t/01basic.t ......
t/01basic.t ...... 1/4
Compiled against: libxslt 10126, libxml2 20707
Running: libxslt 10126, libxml2 20707
Compiled with EXSLT: yes

t/01basic.t ...... ok
t/02dromeds.t .... ok
t/03input.t ...... ok
t/04params.t ..... ok
t/05quick.t ...... ok
t/06entities.t ... ok
t/06output.t ..... ok
t/07blankdoc.t ... ok
t/08literal.t .... ok
t/09exslt.t ...... ok
t/10functions.t .. ok
t/11utf8.t ....... ok
t/12import.t ..... ok
t/13error.t ...... ok
t/14security.t ... ok
t/15misc.t ....... ok
All tests successful.
Files=16, Tests=231, 2 wallclock secs ( 0.14 usr + 0.00 sys = 0.14 CPU)
Result: PASS

ken15 | Thu, 2011-07-21 20:00

I was trying repeat what you have done, but it certainly not very easy. I would really appreciate if you shared a PPM. Also, I'd be happy to put it on a webserver for you and give you a link if you want to share it with community.

zatlas1@yahoo.com | Tue, 2011-09-06 09:12

Is there any activity on that? We all may benefit from that
Thanks
ZA