Installing ActivePerl and MinGW from scratch

bart on 2007-08-22T00:58:44

As you may well know, in modern releases of ActivePerl 5.8.x, ActiveState has provided automatic support for (free) alternative C compilers to build XS modules in. I've been doing that for a while now... but I had no idea how hard it is these days, to install them both from scratch.

It's now the second time in about a month time, that I'm doing this. This time, I took extra care to carefully remove old installations, so I can safely say I'm doing a blank install. The only thing I already have, is MS nmake, and it's in PATH.

First I'm installing MinGW. Boy has that become easy! Just go to the MinGW download page, get the installer (MinGW-5.1.3.exe, the top link in the table), and run it. Choose what you want installed, and it'll just fetch the archives and install them. Wow. There's no longer a need for a "metre of beer" contest, this is just too simple.

The previous time I installed ActivePerl (build 820) I had a few problems — solvable, but problems nevertheless. This time, most (all?) of these glitches seem to have gone. That is good news.

I'm still using Win98 on my secondary computer, the primary being an XP laptop. Last time, I had problems running scripts (PPM, perldoc, CPAN) straight from the command line. It refused to run, the only error message I got was "syntax error", which doesn't sound like a Perl error message. I could still run it using

perl -S PPM


so I think it may have been related to something pl2bat did. I thought the resulting scripts were Unix text files, or mixed half Unix text files, half Windows text files. But that seems to have been fixed, it works now.

Next test: CPAN. The previous time building XS files didn't work out of the box, I got weird C compiler errors. After some hours of digging and finally fixing the problem, I found out on ActiveState's bug tracking system it had already been solved months earlier. What the...? But, looking at the patch list for this build, it looks like Jan Dubois has followed his own advice, as all compiler related values have been disabled in configpm, the Perl script that in the source distribution is used to build Config.pm. That implies that now, at least, MinGW should be able to build XS modules out of the box. Excellent.

Except: the version of CPAN.pm that comes with it (1.9102), is broken. It complains about an unimplemented flock call. So I downgraded CPAN.pm by copying the previous version out of the older distribution (1.7602). Did I mention I use the AS distro, not the MSI file? I do. It's a plain ZIP file with a relocation script. Nice and transparent for cases like this. After undergoing a bit of panicking by CPAN.pm about the .lock file, and manually deleting it a few times, it finally ran.

I had to first manually add the bin directory for MinGW to my PATH, because ActivePerl didn't see my gcc. Perhaps that is better in XP — the mechanism to permanently set environment variables is different there.

But then, MinGW can indeed build XS modules out of the box. I tried Text::CSV_XS, HTML::Parser, DBI, and DBD::SQLite as test cases; only DBI had some tests fail but I suppose that is, again, because of the platform. There were some complaints about flock not being implemented.

All in all, things are looking good — except that the included CPAN version refuses to work on Win98. But you probably will not have that problem on XP.


Good to see they are starting to catch up...

Alias on 2007-08-22T04:07:24

... but I still think it's faster and safer to just

1. Download Strawberry
2. Run Installer
3. Click Next once or twice and wait 10 seconds

That said, we don't officially support Win98, so I have no idea what sort of behaviour it would exhibit.