Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Compiling Win32::AdminMisc on ActiveState 5.10

by ramtek (Novice)
on Oct 15, 2008 at 20:39 UTC ( [id://717337]=perlquestion: print w/replies, xml ) Need Help??

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

More of a statement than a question but I have seen the question enough to share. Compiling Win32::AdminMisc is a pain (especially for Perl 5.10. There were a few steps to it and although posts I have seen on here are helpful they aren't complete. Here are the steps I had to take to be able to compile Win32::AdminMisc on Win32 perl 5.10 running on Windows XP SP3 (a ghetto tutorial) :

Install ActiveState Perl 5.10 installed (duh)
Install Microsoft Visual Studio 6
Install Microsoft Visual Studio 6 SP5
Install Microsoft Visual Studio C++ 6.0 Processor Pack
Install Microsoft Platform SDK for Windows XP SP2

Unzip source code for Admin::Misc unzipped somewhere (will create an include directory). I unzipped it to C: since Roth's code seems to like this for some reason. If you encounter whining about an S drive and a missing directory and you have no drive S just do a "net use s: \\%computername%\c$" so it can make whatever it needs and continue.

Change Line 87 of your Win32Perl.h to "#if PERL_VERSION >= 8" as advised in another perlmonks post (lost the link)

Copy CUString.lib and CUString.hpp (you can get them from Win32-Scheduler_v20000702.tar) to the include directory created when you unzipped your source code

Once all that is done you can compile. %PERL510% in my case c:\perl510 and %SDK% is "C:\Program Files\Microsoft Platform SDK for Windows XP SP2".

Notice you are using the Lib folder under the SDK install not the one installed with Visual Studio.

If you don't reference KERNEL32.LIB on the command line you will see GlobalMemoryStatusEx errors (which are highly annoying)

Here is my full working build line . . . second thought why not just finish it off with a batch :

REM COMPILE WIN32::ADMINMISC set BASE_DIR=c: set SDK=C:\Program Files\Microsoft Platform SDK for Windows XP SP2 set PERL510=c:\perl510 cd %BASE_DIR% cl -MT -LD -EHsc -I"%SDK%\Include" -I"%PERL510%\lib\CORE" -I"%BASE_DIR +%\include" -I"%BASE_DIR%" -DWIN32 -DPERL5008 adminmisc.cpp CDNS.cpp C +FunMap.cpp constant.cpp DNS.CPP CPUID.C Speed.c WinCPUID.c CUString.l +ib WinCPUIDlib.lib \lib\Accounts_Lite.lib %PERL510%\lib\CORE\perl510. +lib "%SDK%\Lib\USER32.LIB" "%SDK%\Lib\ADVAPI32.LIB" "%SDK%\Lib\WSOCK3 +2.LIB" "%SDK%\Lib\KERNEL32.LIB" "%SDK%\Lib\NETAPI32.LIB" "%SDK%\Lib\W +INMM.LIB" "%SDK%\Lib\VERSION.LIB" ADMINMISC.DEF /link /nodefaultlib:l +ibc echo Installing Win32::AdminMisc mkdir %PERL510%\site\lib\Win32 copy %BASE_DIR%\AdminMisc.pm %PERL510%\site\lib\Win32\ >nul mkdir %PERL510%\site\lib\auto\Win32\AdminMisc<br> copy %BASE_DIR%\AdminMisc.dll %PERL510%\site\lib\auto\Win32<br>\AdminM +isc\ >nul echo #!%PERL510%\bin\perl.exe -w > %BASE_DIR%\test.pl echo eval { use Win32::AdminMisc; }; if ($@){ print "Win32::AdminMisc +didn't load : $@\n"; } else { print "Win32::AdminMisc loaded ok\n"; } + exit 1; >> %BASE_DIR%\test.pl perl %BASE_DIR%\test.pl
Watch the line wraps. This should get anyone trying to do this to the point where they are just gathering files and not having to work hard to get back to what they had in Perl 5.8.
I'm a bit surprised that Dave Roth doesn't maintain a ppd for this module since his book which is excellent for Windows Admins uses it extensively. Hopefully this helps someone.

-Matt

Replies are listed 'Best First'.
Re: Compiling Win32::AdminMisc on ActiveState 5.10
by vkon (Curate) on Oct 16, 2008 at 06:49 UTC
    from your explanations I don't understand why using
    perl Makefile.PL nmake
    does not work for you.

    It actually works for me (for other modules - I haven't tried AdminMisc) but you should report and fix errors starting namely this way - any errors should be fixed from there

    That said, IMO you're heading wrong direction.
    BR,
    VK.

      This was the whole point. AdminMisc is still quite useful but not maintained any longer and annoying to recompile (it deals with the Windows API afterall). If you want to upgrade to Perl 5.10 you won't be able to find a PPM so without a fairly old compiler and the process I posted you would be out of luck


      UPDATE :

      OK, I have received a lot of mail since posting this so decided to add support for 5.10 to Roth's existing ppd and host it on my site at http://www.ramtek.us.

      That ppd should work for ActiveState 5.6,5.8 and 5.10

      Enjoy

      -M
        I went to the website, but could find nothing - can you send me a link? Thanks in advance for your support.
        Thanks, EigenFunctions
        Do you have the setup (and energy) to provide Win32::AdminMisc for ActiveState 5.12 ??? Thanks
        This is awesome, thanks so much!
        I had a look at the roth website, and all the modules I examined (all both of them) appear to be available under the Artistic License or the GPL.

        So the good news is that there's nothing stopping anyone from getting the code and fixing the makefile, and making the forked version of the module available to the world.

        However, the bad news is that there's nothing anyone can do to force that change back onto the roth website (well, unless you're his mum, perhaps) and it takes time and effort to maintain a forked module (otherwise, some poor soul has exactly the same problem with the next bug they want fixed, but doubled).

        Anyone tried asking nicely?

        Failing that, does anyone know his mum?

        --
        .sig : File not found.

        then, this is the first bug to fix: lack of Makefile.PL

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://717337]
Approved by NetWallah
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found