http://qs1969.pair.com?node_id=22783

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

I have had great trouble installing modules on Win32. I have been trying to install XML::RSS and XML::Parser. This question is really related to module installing under Win32 in general though. Since the modules previously mentioned are apparently more complicated to install than most (since they require a C compiler), I'll explain the trouble I've been having by installing a simpler module -- lhoward's Number::Spell module.

I've been advised to use CPAN.pm's shell mode to install modules, so I thought I'd give that a try. I run

perl -MCPAN -e shell

from the DOS prompt. I then type 'install Number::Spell'. Lots of information appears, but the program finally exits with:

When installing with CPAN: Subprocess "|C:\WINDOWS\ftp.exe -n" returned status 16777215 (wstat -1) Bad luck... Still failed! Can't access URL ftp://usit.shef.ac.uk/pub/packages/CPAN/authors/id/G/ +GB/GBARR/l ibnet-1.0703.tar.gz.
So, I think to myself, I'll just try 'the hard way'. I downloaded the Number::Spell .tar.gz file. Unzipped and untarred it into a new directory. I understand that I need a make program, so I get both nmake and GNU make. I run

perl makefile.pl

..and get the following error:

Checking if your kit is complete... Looks good Bad command or file name Bad command or file name Unable to find a perl 5 (by these names: C:\perl\bin\Perl.exe miniperl + perl perl 5 perl5.6.0, in these dirs: C:\WINDOWS c:\windows c:\windows\COMMAND C +:\BITWARE\ C:\PERL\BIN c:\perl\bin) Writing Makefile for Number::Spell
Apparently, it can't find Perl on my machine. It's looking for a file named 'c:\perl\bin\perl.exe' in 'c:\perl\bin' which of course it won't find (in my mind it should be looking for perl.exe in c:\perl\bin).

Nevertheless, I try and run make anyway: (I used GNU Make since nmake didn't agree with the syntax of the makefile).

process_begin: CreateProcess((null), 0 -Ic:perllib -Ic:perllib -MExtUt +ils::Comma nd -e mkpath bliblibNumber, ...) failed. make (e=2): The system cannot find the file specified. C:\WINDOWS\MAKE.EXE: *** [blib\lib\Number\.exists] Error 2
This made me a bit suspicious, since from the error message I assumed that make couldn't shell out to Perl. (Hardly surprising I suppose given that makefile.pl couldn't find Perl). I know a little bit about makefiles from a C++ programming course that I did so I thought I'd have a look around. I immediately find 2 lines in the makefile that worry me:

PERL = 0 FULLPERL = 0
After looking in MakeMaker.pm's documentation, my suspicions are confirmed, and I know that these should be set to names of the Perl binary. So I change it to:

PERL = perl.exe FULLPERL = perl.exe
I figure I don't have to provide the absolute path, since I've got c:\perl\bin in my PATH environment variable. I then trying running make again, and get:
mkdir bliblibNumber mkdir blibarchautoNumberSpell mkdir bliblibautoNumberSpell mkdir blibman3
These directory names look like they're missing slashes to me. But I think "What the heck" and just trying doing 'make install' anyway. I get:
Writing c:\perl\lib\site\auto\Number\Spell\.packlist mkdir c:perllib Appending installation info to c:\perl\lib/perllocal.pod
Again, the dir name in the mkdir line looks suspicious.

I just hoped that it might just have installed the module, so I write a quick one-liner to test it out:

perl -e "use Number::Spell;"
and I get the dreaded "Cannot locate Number/Spell.pm in @INC" etc error.

CPAN is often cited as a major advantage of Perl, and undoubtedly it is. Popular CPAN modules like LWP which have now made it into the standard Perl distro have undoubtedly saved me hours of time, but I don't see why these modules are so hard to install. I know it may be easier on UNIX, but I tend to my development work on Win32 and then deploy on UNIX, so I really need modules installed on Win32.

I'm using ActiveState Perl so I thought I'd try PPM, but there aren't packages available for the modules I want, and I've had plenty of other issues with it.

Any help is greatly appreciated.

Replies are listed 'Best First'.
(jcwren) RE: Installing modules on Win32
by jcwren (Prior) on Jul 17, 2000 at 00:53 UTC
    I've installed a fair number of modules under Windows NT. The first thing you need to check is that perl is in your PATH environment variable. It's conceivable that although an association is set up for files ending .pl to find the perl binary, it's not in your path. If not, I would recommend modifying your user environment variables in Start|Control Panel|System|Environment, if you're under NT. If it's W98, I guess I'd put it in autoexec.bat, or somesuch.

    Once you have the tools in place, installing Perl modules under Windows is little different than installing under *nix. I probably have about 25 "after-market" modules installed, that I've had no problems. I have had one or two that are poorly written that wouldn't install easily, but they're really the exception.

    Windows FTP has to be one of the lamest FTP clients around. There are several good ones, such as WSFTP. You'll find that they work a lot better (and more importantly, support passive mode, if you're behind a firewall that doesn't permit non-passive FTPs). You can find these at www.tucows.com.

    If you require a compiler to build a module (as opposed to a pure perl module), you'll definitely need a compiler. My understanding is that you'll need whatever release of compiler was used to build your Perl binary. I don't have any experience with any other than the MSVC C++, so I can't say with any authority if that's true or not.

    The fact that the module doesn't work after hacking up the makefile is no big surprise. My experience says those are touchy things to go hacking in. I'm sure the Perl gurus can casually create a makefile for installing, but I have to h2xs or MakeMaker.

    And as a final note, allow me to compliment on the information provided to help track down your problem. This is the kind of information that encourages people to spend the time helping. Kudos!

    --Chris

    e-mail jcwren
Re: Installing modules on Win32
by gaggio (Friar) on Jul 17, 2000 at 05:47 UTC
    Two things.

    First, do you actually have the right version of Perl installed? It seems that the module you are installing requires Perl 5.6 and not another one. Also, what distribution of Perl are you running? ActivePerl?

    Second, ActiveState comes with a nice utility to install modules. I is called ppm (Perl Package Manager). With it you can search CPAN for modules and install them from there directly.

    I have done that for you (since at some point I will probably need to use XML-Parser also):

    C:\ppm
    PPM> search xml

    Here's what ppm found on CPAN:
    Packages available from http://www.activestate.com/Packages/: CGI-XMLForm, XML-DOM, XML-Element, XML-Parser

    Ok, so let's install XML-Parser:
    PPM> install XML-Parser
    Install package 'XML-Parser?' (y/N): y
    Retrieving package 'XML-Parser'...
    Installing C:\Perl\site\lib\auto\XML\Parser\Expat\Expat.dll
    Installing C:\Perl\site\lib\auto\XML\Parser\Expat\Expat.exp
    Installing C:\Perl\site\lib\auto\XML\Parser\Expat\Expat.lib
    Installing C:\Perl\html\lib\site\XML\Parser\Expat.html
    Installing C:\Perl\html\lib\site\XML\Parser.html
    Installing C:\Perl\htmlhelp\pkg-XML-Parser.chm
    Installing C:\Perl\htmlhelp\pkg-XML-Parser.hhc
    Installing C:\Perl\site\lib\XML\Parser\Encodings\Japanese_Encodings.msg
    Installing C:\Perl\site\lib\XML\Parser\Encodings\README
    Installing C:\Perl\site\lib\XML\Parser\Expat\expat.html
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmlparse\hashtable.c
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmlparse\hashtable.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmlparse\xmlparse.c
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmlparse\xmlparse.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\ascii.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\asciitab.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\iasciitab.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\latin1tab.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\nametab.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\utf8tab.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmldef.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmlrole.c
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmlrole.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmltok.c
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmltok.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmltok_impl.c
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmltok_impl.h
    Installing C:\Perl\site\lib\XML\Parser\Expat\xmltok\xmltok_ns.c
    Installing C:\Perl\site\lib\XML\Parser\Expat.pm
    Installing C:\Perl\site\lib\XML\Parser.pm
    Writing C:\Perl\site\lib/auto/XML-Parser/.packlist

    So... You can see that it was that easy: there was no compilation required since ppm fetches the precompiled binaries for you! I am personnaly using Active Perl 5.005. I have not decided yet if I wanted to go with Perl 5.6 or not. Right now, I don't need it. I am also waiting a little since I have heard about lots of problems with ActivePerl 5.6. Maybe that the next version will be more stable?
    Anyway, good luck :-)
      I realize I'm coming into this discussion a little late, but I thought I'd note something about ActiveState's PPM service. It does NOT search CPAN and it is by no means complete with regards to what's available there. I've entered searches for modules that I've seen on CPAN and didn't want to have to go through the hassle of building, to no avail. If I type "search Win32" using PPM, I get four packages - API, DDE, Sound, and TieRegistry. That's it. Typing in Win32 at CPAN results (today - 28 Aug 00) in 88 modules. Quite a discrepancy.
      FWIW, I'm using ActiveState's Perl 5.6 with 1 patch, so I don't know if the repositories are different for other 5.x versions. All I know is what I've seen.

      Guildenstern
      Negaterd character class uber alles!
Re: Installing modules on Win32
by Shoeboy (Sexton) on Jul 17, 2000 at 04:49 UTC
    I've not run into problems with CPAN on win32, so I can't really help all that much.
    First thing you need to check is your path. You said you had c:\perl\bin there, but I'd double check.
    Secondly, you need to check your config.pm in c:\perl\lib. I'm not a big fan of the active state installers. Build 522 set up all my paths as \\peterj\perl\whatever instead of c:\perl\whatever. This didn't appear to break anything, but did cause a lot of warning messages.
    I had to roll back to build 522 for compatability with the PDK, so I can't try this on a 5.60 version, but Number::Spell installed just fine using nmake on my system. And I didn't have any problems when I was running build 613.
    If all else fails, you can try to copy the Spell.pm to C:\Perl\site\lib\Number\Spell.pm
    --Shoeboy
    perl -e "do {kill $java, $ada, $cobol, $pascal, $csh;} until die 'Just another perl hacker';"
Re: Installing modules on Win32
by tye (Sage) on Jul 17, 2000 at 21:33 UTC
    • Bad command or file name
    You should investigate where these are coming from.
    • Unable to find a perl 5 (by these names: C:\perl\bin\Perl.exe miniperl perl perl
    This looks like the version of Perl you are using doesn't realize that '\\' is a path delimiter. If it did, it would strip the first part and be looking for "perl.exe" in your PATH. I suspect both of these problems stem from trying to combine Unixish tools and ActivePerl. A lot of work has gone into getting Perl to work under Win32 and a lot of work has gone into building Unixish things for Win32, including making those Unixish things able to build and use Perl in a Unixish manner. However, using ActivePerl in a Unixish environment for Win32, is going to generate a few problems.
    • I used GNU Make since nmake didn't agree with the syntax of the makefile

    This means that the version of Perl you are using has not been configured to be used with nmake.

    Which brings us to the golden rule when installing modules:

    • Build (and install) the module using the same tools you used to compile perl!

    "Ah," you say, "but I didn't compile Perl."

    Which lead to two question: "Why not?" and "Then what did whoever compiled it for you use?"

    Those two questions lead to two solutions. First, you can go build Perl yourself and then installing modules works the way it was originally designed to.

    Second, you can try to duplicate the environment that ActiveState (or whoever) used to compile your Perl so that installing modules will work.

    Third (surprise!), you can try to hack the configuration files (which are set up automatically when you compile Perl) to match whatever environment you have lying around for building modules. This may or may not work. Support for this is slowly growing, especially for the case of using free tools to build/install modules for "ActivePerl".

    I think if you look around you can find FAQs covering the last two choices. The first choice is covered in the instruction files that come with the Perl source code.

Re: Installing modules on Win32
by Ugly (Beadle) on Jul 17, 2000 at 16:15 UTC
    There's an excellent article by Jenda Krynicky in an old issue of PerlMonth which covers the whole issue of installing modules into Win32 Perl, its worth a read.

    By the way, does anybody know what's happened to PerlMonth, there han't been a new issue for ages?

    --Ugly

Re: Installing modules on Win32
by toadi (Chaplain) on Jul 17, 2000 at 16:03 UTC
    Like said before use the right version of perl for the modules.

    When using activestate use ppm , this is a nice tool for installing packages.

    But I like dynamicstate more. Because of the fact you can install from activestate, dynamicstate and from cpan all with a som clicking in a browser!!! It does this all nicely even installing/compiling from cpan.
    On a side-note it also has a apache with cgi to test your scripts in it's distribution.
    Check it out. Try them both an read the docs coming with them!
    --
    My opinions may have changed,
    but not the fact that I am right

Re: Installing modules on Win32
by Tally (Novice) on Jul 17, 2000 at 21:22 UTC
    I've had many of the same problems you describe. I haven't solved them all, but here are some things that have definitely helped:

    Setting up CPAN

    The first time you try to download cpan modules using perl ("perl -MCPAN ...") it will lead you through a setup, asking lots of questions about where different resources are located on your computer. If you answer these questions incorrectly, your CPAN client won't work. But, when you start it again it doesn't prompt you to change settings. To fix this, you can go to the directory "x:\(perl-path)\lib\CPAN" and delete the file "config.pm". Then the next time you use the CPAN client it will ask all the setup questions again.

    The CPAN client wants a whole bunch of tools that you may have to download. The problems I've run into here are that some "unzip" and "tar" programs are not 100% compatible with CPAN. Be sure that the programs you're using know how to deal with Windows NT long file names. Most perl modules contain files with names that are illegal under the old DOS eight-char-name-three-char-extension standard.

    One solution that worked well for me was downloading CYGWIN, a Win32 unix emulator with Win32 versions of lots of the normal unix tools like gzip and tar that the CPAN client needs. To get the tools to work under a Windows NT command prompt, you have to copy cygwin.dll to the system32 directory.

    Tally
      Tally, I've downloaded cygwin user tools but I've haven't been able to get it working? I think there needs to be a tutorial on installing "cygwin for dummies" I'm running windows 2000 but I want to use the same type of unix commands at the command prompt. e-mail me! kjh28@cornell.edu
Re: Installing modules on Win32
by cik_ail (Initiate) on Feb 25, 2005 at 03:06 UTC
    Having same problem here, but i've managed to pass the

    perl Makefile.Pl


    Oh yeah, i'm trying to install Crypt::Rijndael module
    But then, when i came across the nmake I've got these
    C:\Documents and Settings\Wassup>cd Desktop\Crypt-Rijndael-0.05 C:\Documents and Settings\Wassup\Desktop\Crypt-Rijndael-0.05>perl Make +file.PL Checking if your kit is complete... Looks good Writing Makefile for Crypt::Rijndael C:\Documents and Settings\Wassup\Desktop\Crypt-Rijndael-0.05>nmake Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cp Rijndael.pm blib\lib\Crypt\Rijndael.pm cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSO +LE -DNO_ST RICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_I +MPLICIT_SY S -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION +=\"0.04\" -DXS_VERSION=\"0.04\" "-IC:\Perl\lib\CORE" _rijndael.c 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code + '0x1' Stop.

    Then when i just ignore it, i got these when using nmake test
    Microsoft (R) Program Maintenance Utility Version 1.50 Copyright (c) Microsoft Corp 1988-94. All rights reserved. cl -c -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSO +LE -DNO_ST RICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_I +MPLICIT_SY S -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION +=\"0.04\" -DXS_VERSION=\"0.04\" "-IC:\Perl\lib\CORE" _rijndael.c 'cl' is not recognized as an internal or external command, operable program or batch file. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code + '0x1' Stop.

    So, you can conclude that i can't install it then..

    But, i can install certain other module.. do help

      use ppm to install the module, hence fetch a precompiled version. Crypt-Rijndael is available from several repositories.
      Type help rep in the ppm-shell to find out how to add a repository to your ppm.
      ppm> search Crypt-Rijndael Searching in Active Repositories 1. Crypt-Rijndael [0.04] 2. Crypt-Rijndael [0.04] Crypt::CBC compliant Rijndael encryption mo +dule 3. Crypt-Rijndael [0.04] Crypt::CBC compliant Rijndael encryption mo +dule 4. Crypt-Rijndael [0.04] ppm> desc 1 ==================== Package 1: Name: Crypt-Rijndael Version: 0.04 Author: Title: Crypt-Rijndael Abstract: Location: soulcage58 Available Platforms: 1. MSWin32-x86-multi-thread-5.8 ==================== ppm> desc 2 ==================== Package 2: Name: Crypt-Rijndael Version: 0.04 Author: Rafael R. Sevilla <sevillar@team.ph.inter.net> Title: Crypt-Rijndael Abstract: compliant Rijndael encryption module Location: theoryS Available Platforms: 1. MSWin32-x86-multi-thread ==================== ppm> desc 3 ==================== Package 3: Name: Crypt-Rijndael Version: 0.04 Author: Rafael R. Sevilla <sevillar@team.ph.inter.net> Title: Crypt-Rijndael Abstract: compliant Rijndael encryption module Location: theory58S Available Platforms: 1. MSWin32-x86-multi-thread-5.8 ==================== ppm> desc 4 ==================== Package 4: Name: Crypt-Rijndael Version: 0.04 Author: Title: Crypt-Rijndael Abstract: Location: soulcage Available Platforms: 1. MSWin32-x86-multi-thread ==================== ppm>


      holli, /regexed monk/
        Thanx.. But other than ppm, can there be other way to download.. Because, I could not connect to the repository.. My place (the university i'm using) couldnt pass through..