Subject: | Crypt::DES fails to compile on perl-5.17.8 |
Hello,
Crypt::DES v2.05 fails to compile on perl-5.17.8 with the following error message:
----
Building and testing Crypt-DES-2.05
cp DES.pm blib/lib/Crypt/DES.pm
/Users/fge7z/perl5/perlbrew/perls/perl-5.17.8/bin/perl5.17.8
/Users/fge7z/perl5/perlbrew/perls/perl-5.17.8/lib/5.17.8/ExtUtils/xsubpp -typemap
/Users/fge7z/perl5/perlbrew/perls/perl-5.17.8/lib/5.17.8/ExtUtils/typemap -typemap
typemap\
DES.xs > DES.xsc && mv DES.xsc DES.c
cc -c -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -
I/usr/local/include -O3 -DVERSION=\"2.05\" -DXS_VERSION=\"2.05\" "-
I/Users/fge7z/perl5/perlbrew/perls/perl-5.17.8/lib/5.17.8/darwin-2level/CORE" DES.\
c
DES.xs: In function ‘XS_Crypt__DES_crypt’:
DES.xs:67: error: wrong type argument to unary exclamation mark
make: *** [DES.o] Error 1
-> FAIL Installing Crypt::DES failed. See /Users/fge7z/.cpanm/build.log for details.
----
That error corresponds to this line in DES.xs:
----
if (!SvUPGRADE(output, SVt_PV))
croak("cannot use output argument as lvalue");
----
Searching the perl git log for SvUPGRADE turned up this commit:
----
commit 463ea2290a54ee65470ca4dd46dea0d41cfbc9dd
Author: David Mitchell <davem@iabyn.com>
Date: Fri Dec 14 15:05:40 2012 +0000
make SvUPGRADE() a statement.
To guote the perldelta entry:
SvUPGRADE() is no longer an expression. Originally this macro (and its
underlying function, sv_upgrade()) were documented as boolean, although
in reality they always croaked on error and never returned false. In 2005
the documentation was updated to specify a void return value, but
SvUPGRADE() was left always returning 1 for backwards compatibility. This
has now been removed, and SvUPGRADE() is now a statement with no return
value.
So this is now a syntax error:
if (!SvUPGRADE(sv)) { croak(...); }
If you have code like that, simply replace it with
SvUPGRADE(sv);
----
I replaced the problem line in DES.xs as suggested in the commit message and the module
compiled and tested fine. I don't actually know anything about XS, so can't say for sure this is
the correct fix, but it seems to work and all the modules that I was installing that depend on
Crypt::DES passed their tests as well.
Thank you for your time and hard work on this module and have a great weekend!
Cheers,
Fitz Elliott