无法在 Windows 10 上安装 Algorithm::AhoCorasick::XS,MSYS2:'sigjmp_buf' 未命名类型;您的意思是“Sigjmp_buf”吗

问题描述

我正在尝试在 Windows 10、MSYS2 上安装 Algorithm::AhoCorasick::XS

Nocopy

这里可能有什么问题?

解决方法

似乎 C++ 选项 -std=c++11 混淆了 MSYS2。在 Makefile.PL 行 #20 中,我们有:

CCFLAGS       => '-Wall -std=c++11',

如果我删除 -std=c++11 并保存文件并重新编译,它工作正常:

$ make clean
$ perl Makefile.PL
$ make
cp lib/Algorithm/AhoCorasick/XS.pm blib/lib/Algorithm/AhoCorasick/XS.pm
Running Mkbootstrap for XS ()
chmod 644 "XS.bs"
"/usr/bin/perl.exe" -MExtUtils::Command::MM -e 'cp_nonempty' -- XS.bs blib/arch/auto/Algorithm/AhoCorasick/XS/XS.bs 644
g++ -c   -Wall -DUSEIMPORTLIB -march=x86-64 -mtune=generic -O2 -pipe   -DVERSION=\"0.04\" -DXS_VERSION=\"0.04\"  "-I/usr/lib/perl5/core_perl/CORE"   Matcher.cpp
"/usr/bin/perl.exe" "/usr/share/perl5/core_perl/ExtUtils/xsubpp"  -C++ -typemap '/usr/share/perl5/core_perl/ExtUtils/typemap' -typemap '/home/hakon/perl/cpan-source/Algorithm-AhoCorasick-XS-0.04/perlobject.map' -typemap '/home/hakon/perl/cpan-source/Algorithm-AhoCorasick-XS-0.04/typemap' -typemap '/home/hakon/perl/cpan-source/Algorithm-AhoCorasick-XS-0.04/typemap'  ac.xs > ac.xsc
mv ac.xsc ac.c
g++ -c   -Wall -DUSEIMPORTLIB -march=x86-64 -mtune=generic -O2 -pipe   -DVERSION=\"0.04\" -DXS_VERSION=\"0.04\"  "-I/usr/lib/perl5/core_perl/CORE"   ac.c
In file included from ac.xs:11:
ppport.h:4594: warning: "WIDEST_UTYPE" redefined
 4594 | #  define WIDEST_UTYPE U64TYPE
      |
In file included from /usr/lib/perl5/core_perl/CORE/perl.h:2753,from ac.xs:5:
/usr/lib/perl5/core_perl/CORE/handy.h:1251: note: this is the location of the previous definition
 1251 | #   define WIDEST_UTYPE U64
      |
g++ -c   -Wall -DUSEIMPORTLIB -march=x86-64 -mtune=generic -O2 -pipe   -DVERSION=\"0.04\" -DXS_VERSION=\"0.04\"  "-I/usr/lib/perl5/core_perl/CORE"   test.c
rm -f blib/arch/auto/Algorithm/AhoCorasick/XS/XS.dll
g++  --shared  -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong  Matcher.o ac.o test.o  -o blib/arch/auto/Algorithm/AhoCorasick/XS/XS.dll  \
  /usr/lib/perl5/core_perl/CORE/msys-perl5_32.dll    \

chmod 755 blib/arch/auto/Algorithm/AhoCorasick/XS/XS.dll
Manifying 1 pod document
$ make test
"/usr/bin/perl.exe" -MExtUtils::Command::MM -e 'cp_nonempty' -- XS.bs blib/arch/auto/Algorithm/AhoCorasick/XS/XS.bs 644
PERL_DL_NONLAZY=1 "/usr/bin/perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0,'blib/lib','blib/arch')" t/*.t
t/basic.t ....... ok
t/details.t ..... ok
t/edge_cases.t .. ok
t/utf8.t ........ ok
t/variation.t ... ok
All tests successful.
Files=5,Tests=1624,2 wallclock secs ( 0.14 usr  0.06 sys +  0.64 cusr  0.85 csys =  1.69 CPU)
Result: PASS

另见this问题。