Perl: cpan install B::C failed
OS: archlinux 3.9.4-1-ARCH
Perl version: v5.18.0
cpan install B::C 后在make时会出现如下错误:
/usr/lib/perl5/core_perl/CORE/sv.h:457:26: 错误:expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
看来是语法错误,却不知怎么改,以下给出这个sv.h的448~470行的代码:
#define _XPV_HEAD \
HV* xmg_stash; /* class package */ \
union _xmgu xmg_u; \
STRLEN xpv_cur; /* length of svu_pv as a C string */ \
union { \
STRLEN xpvlenu_len; /* allocated size */ \
char * xpvlenu_pv; /* regexp string */ \
} xpv_len_u
#define xpv_len xpv_len_u.xpvlenu_len /*!! 出错的那一行*/
union _xnvu {
NV xnv_nv; /* numeric value, if any */
HV * xgv_stash;
struct {
U32 xlow;
U32 xhigh;
} xpad_cop_seq; /* used by pad.c for cop_sequence */
struct {
I32 xbm_useful;
U8 xbm_rare; /* rarest character in string */
} xbm_s; /* fields from PVBM */
};
[解决办法]
用cpan install 安装要针对OS和Perl version,选对版本!
例如
http://search.cpan.org/~roode/Time-Format-1.12/
点该页的link [ Perl/Platform Version Matrix ]
进入http://matrix.cpantesters.org/?dist=Time-Format+1.12
查看适用的版本