为什么我不能在 Strawberry Perl 5.28.1 上构建'true'编译指示模块?



我正在从头开始重建一个Windows 10(64位)工作站,在构建一个特定的CPAN模块时遇到了一个障碍:true。这是一个完善的模块—上次更新是在2011年—我已经在Strawberry Perl的早期版本上使用了多年,直到5.26。我对出了什么问题感到困惑。

我构建模块如下:

C:Strawberrycpanbuildtrue-0.18-0> perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for true
Writing MYMETA.yml and MYMETA.json
C:Strawberrycpanbuildtrue-0.18-0> gmake
cp lib/true/VERSION.pm bliblibtrueVERSION.pm
cp lib/true.pm bliblibtrue.pm
Running Mkbootstrap for true ()
"C:Strawberryperlbinperl.exe" -MExtUtils::Command -e chmod -- 644 "true.bs"
"C:Strawberryperlbinperl.exe" -MExtUtils::Command::MM -e cp_nonempty -- true.bs blibarchautotruetrue.bs 644
"C:Strawberryperlbinperl.exe" "C:StrawberryperllibExtUtils/xsubpp"  -typemap C:STRAWB~1perllibExtUtilstypemap  true.xs > true.xsc
"C:Strawberryperlbinperl.exe" -MExtUtils::Command -e mv -- true.xsc true.c
gcc -c  -IC:StrawberryperlsitelibBHooksOPAnnotationInstall -IC:StrawberryperlvendorlibBHooksOPCheckInstall -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields -O3 -Wall -W   -DVERSION="0.18" -DXS_VERSION="0.18"  "-IC:STRAWB~1perllibCORE"   true.c
In file included from true.xs:4:0:
true.xs: In function 'true_leave':
C:STRAWB~1perllibCORE/perl.h:174:22: warning: unused parameter 'my_perl' [-Wunused-parameter]
#  define pTHX  tTHX my_perl PERL_UNUSED_DECL
^
true.xs:25:24: note: in expansion of macro 'pTHX'
STATIC void true_leave(pTHX) {
^
"C:Strawberryperlbinperl.exe" -MExtUtils::Mksymlists 
-e "Mksymlists('NAME'=>"true", 'DLBASE' => 'true', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ true.def -o blibarchautotruetrue.xs.dll -mdll -s -L"C:STRAWB~1perllibCORE" -L"C:STRAWB~1clib" true.o   "C:STRAWB~1perllibCORElibperl528.a" "C:StrawberryperlsitelibautoBHooksOPAnnotationAnnotation.a" "C:StrawberryperlvendorlibautoBHooksOPCheckCheck.a" "C:STRAWB~1cx86_64-w64-mingw32liblibmoldname.a" "C:STRAWB~1cx86_64-w64-mingw32liblibkernel32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibuser32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibgdi32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibwinspool.a" "C:STRAWB~1cx86_64-w64-mingw32liblibcomdlg32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibadvapi32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibshell32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibole32.a" "C:STRAWB~1cx86_64-w64-mingw32libliboleaut32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibnetapi32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibuuid.a" "C:STRAWB~1cx86_64-w64-mingw32liblibws2_32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibmpr.a" "C:STRAWB~1cx86_64-w64-mingw32liblibwinmm.a" "C:STRAWB~1cx86_64-w64-mingw32liblibversion.a" "C:STRAWB~1cx86_64-w64-mingw32liblibodbc32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibodbccp32.a" "C:STRAWB~1cx86_64-w64-mingw32liblibcomctl32.a" -Wl,--enable-auto-image-base
"C:Strawberryperlbinperl.exe" -MExtUtils::Command -e chmod -- 755 blibarchautotruetrue.xs.dll
dlltool --def true.def --output-lib blibarchautotrue/true.a --dllname true.xs.dll blibarchautotruetrue.xs.dll

我不知道关于pTHX的警告是重要的还是可以忽略的。无论如何,它确实生成了一个输出文件true.xs.dll:

C:Strawberrycpanbuildtrue-0.18-0> dir blibarchautotruetrue.xs.dll
Volume in drive C is Local SSD Disk
Volume Serial Number is B4E3-5132
Directory of C:Strawberrycpanbuildtrue-0.18-0blibarchautotrue
01/23/2019  09:53            17,920 true.xs.dll
1 File(s)         17,920 bytes
0 Dir(s)  873,458,094,080 bytes free

但该文件不可用:

C:Strawberrycpanbuildtrue-0.18-0> perl -I blibarchauto -Iblibarchautotrue -I bliblibauto -I bliblib -Mtrue
Can't load 'blibarchautotrue/true.xs.dll' for module true: load_file:The specified module could not be found at C:/Strawberry/perl/lib/DynaLoader.pm line 193.
at - line 0.
Compilation failed in require.
BEGIN failed--compilation aborted.

Dynaloader上的文档并没有真正的帮助,但Dynaloader.pm中第193行附近的代码确实提供了一个提示:

# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
# C code of the extension XS file. Perl reports the error as being
# in this perl code simply because this was the last perl code
# it executed.

所以我的工作理论是";某事";在最新的Perl中更改,导致true模块中的代码腐烂。但我的理论中有一个缺陷:至少有一个CPAN测试人员成功地构建了true(尽管他们使用32位perl)。

我不知所措。有人有什么想法我可以试试吗?

我不确定是否将其作为答案发布,但这至少是解决方案。在花了一天半的时间窥探源代码并尝试各种实验后,我放弃了,删除了64位Strawberry 5.28.1,安装了32位Strawbrary 5.28.1。然后true像冠军一样构建、测试和安装。

我唯一的猜测(这是一个疯狂的猜测)是,这个过程的某个部分是以某种方式在网络上找到一些32位二进制文件并与之交互—尽管我明确地没有设置PERL5LIB或其他Perl-env-var,而且我的PATH中没有任何内容指向任何网络Perl内容。

但我没有时间进一步研究这个问题,32位Perl已经足够胜任我的工作了。非常感谢@Corion和@ikegami花时间和发表评论。

相关内容

最新更新