Subject: | Can't build libwin32-0.191 after installing ExtUtils-ParseXS |
Using perl-5.8.6 I can build libwin32-0.191 without error on WinXP using MSVC++.
After installing ExtUtils-ParseXS-2.08 I find that the Win32::NetAdmin module within libwin32-0.191 no longer builds. The build process dies with this error:
C:\perl5\bin\perl.exe C:\perl5\lib\ExtUtils/xsubpp -typemap C:\perl5\lib\ExtUtils\typemap NetAdmin.xs > NetAdmin.xsc && C:\perl5\bin\perl.exe -MExtUtils::Command -e mv NetAdmin.xsc NetAdmin.c
Didn't find a 'MODULE ... PACKAGE ... PREFIX' line
NMAKE : fatal error U1077: 'C:\perl5\bin\perl.exe' : return code '0xff'
Stop.
This seems to happen because (1) NetAdmin.xs indeed doesn't contain a MODULE ... PACKAGE ... PREFIX line, and (2) because the original xsubpp in perl-5.8.6 did an exit(0) in that case [because its $errors variable was 0 at this point], which nmake.exe doesn't see as a failure, whereas the new xubspp/ExtUtils::ParseXS now does a die() in this case, which nmake.exe does see as a failure and hence stops the build process.
I could not see anything in perlxs or perlxstut that *requires* the presence of the MODULE... line, so I would see this as a bug in ExtUtils-ParseXS. Even if the MODULE... is strictly required, ExtUtils-ParseXS really needs to be tolerant of its absence since the existing xsubpp is ;)
The attached patch, changing the die() to a warn() && exit(0), fixes this problem for me. You may want to use a different idiom, I don't know. (Note that I also tried setting $? to error() before the die(), but found that it still exited with status 2 which nmake.exe saw as a failure, so that's no good.)
Cheers,
- Steve
--- lib/ExtUtils/ParseXS.pm.orig 2004-02-21 03:42:18.000000000 +0000
+++ lib/ExtUtils/ParseXS.pm 2005-02-11 13:08:52.852007100 +0000
@@ -277,7 +277,10 @@
print $_;
}
- die "Didn't find a 'MODULE ... PACKAGE ... PREFIX' line\n" unless defined $_;
+ unless (defined $_) {
+ warn "Didn't find a 'MODULE ... PACKAGE ... PREFIX' line\n";
+ exit 0;
+ }
print <<"EOF";
#ifndef PERL_UNUSED_VAR