System installed Perl is version 5.10.1, which I know is old; these are the joys of RHEL-based distributions! I get the same results whether I use cpan
, or download the module and make
it:
/usr/bin/perl /usr/share/perl5/ExtUtils/xsubpp -typemap /usr/share/perl5/ExtUtils/typemap Sodium.xs > Sodium.xsc && mv Sodium.xsc Sodium.c
Error: Cannot parse function definition from 'crypto_generichash_state * T_PTRREF' in Sodium.xs, line 715
Error: 'crypto_generichash_state *' not in typemap in Sodium.xs, line 735
Error: 'crypto_generichash_state *' not in typemap in Sodium.xs, line 739
Error: 'crypto_generichash_state *' not in typemap in Sodium.xs, line 748
make: *** [Sodium.c] Error 1
The section around line 715 looks like this:
TYPEMAP: <<EOT
crypto_generichash_state * T_PTRREF
EOT
I assume the "not in typemap" errors are a result of the initial one, but I'm completely inexperienced with how Perl modules are built; I'm not even sure what this XS stuff is. Any suggestions for how to continue?
The version of ExtUtils::ParseXS
that comes stock with Centos 6 does not support embedded typemap
. Installing the latest ExtUtils::ParseXS
and libsodium
should fix the issue.
From https://perldoc.perl.org/perlxstypemap.html#Anatomy-of-a-typemap:
Traditionally, typemaps needed to be written to a separate file, conventionally called
typemap
in a CPAN distribution. With ExtUtils::ParseXS (the XS compiler) version 3.12 or better which comes with perl 5.16, typemaps can also be embedded directly into XS code using a HERE-doc like syntax:TYPEMAP: <<HERE ... HERE
where
HERE
can be replaced by other identifiers like with normal Perl HERE-docs. All details below about the typemap textual format remain valid.