Why can't I build 'true' pragma module on Strawberry Perl 5.28.1?

170 Views Asked by At

I'm rebuilding a Windows 10 (64 bit) workstation from scratch, and I've hit a snag in building one particular CPAN module: true. This is a well-established module— it was last updated in 2011!— and I've used it for years on previous versions of Strawberry Perl, up to and including 5.26. I'm mystified as to what's going wrong.

I build the module as follows:

C:\Strawberry\cpan\build\true-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:\Strawberry\cpan\build\true-0.18-0> gmake
cp lib/true/VERSION.pm blib\lib\true\VERSION.pm
cp lib/true.pm blib\lib\true.pm
Running Mkbootstrap for true ()
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "true.bs"
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- true.bs blib\arch\auto\true\true.bs 644
"C:\Strawberry\perl\bin\perl.exe" "C:\Strawberry\perl\lib\ExtUtils/xsubpp"  -typemap C:\STRAWB~1\perl\lib\ExtUtils\typemap  true.xs > true.xsc
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- true.xsc true.c
gcc -c  -IC:\Strawberry\perl\site\lib\B\Hooks\OP\Annotation\Install -IC:\Strawberry\perl\vendor\lib\B\Hooks\OP\Check\Install -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~1\perl\lib\CORE"   true.c
In file included from true.xs:4:0:
true.xs: In function 'true_leave':
C:\STRAWB~1\perl\lib\CORE/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:\Strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
-e "Mksymlists('NAME'=>\"true\", 'DLBASE' => 'true', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ true.def -o blib\arch\auto\true\true.xs.dll -mdll -s -L"C:\STRAWB~1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" true.o   "C:\STRAWB~1\perl\lib\CORE\libperl528.a" "C:\Strawberry\perl\site\lib\auto\B\Hooks\OP\Annotation\Annotation.a" "C:\Strawberry\perl\vendor\lib\auto\B\Hooks\OP\Check\Check.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libkernel32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuser32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomdlg32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libadvapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\liboleaut32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libmpr.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\c\x86_64-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-image-base
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 755 blib\arch\auto\true\true.xs.dll
dlltool --def true.def --output-lib blib\arch\auto\true/true.a --dllname true.xs.dll blib\arch\auto\true\true.xs.dll

I don't know if the warning about pTHX is significant or ignorable. Anyhow, it does generate an output file true.xs.dll:

C:\Strawberry\cpan\build\true-0.18-0> dir blib\arch\auto\true\true.xs.dll
Volume in drive C is Local SSD Disk
Volume Serial Number is B4E3-5132

Directory of C:\Strawberry\cpan\build\true-0.18-0\blib\arch\auto\true

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

But the file is unusable:

C:\Strawberry\cpan\build\true-0.18-0> perl -I blib\arch\auto -Iblib\arch\auto\true -I blib\lib\auto -I blib\lib\ -Mtrue
Can't load 'blib\arch\auto\true/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.

The documentation on Dynaloader doesn't really help, but the code in Dynaloader.pm near line 193 does provide a hint:

# 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.

So my working theory is that “something” changed in the latest Perl, causing code rot in the true module. But there's a flaw in my theory: at least one CPAN tester has successfully built true (although they did it with 32-bit perl).

I'm at a loss. Anyone got any ideas I can try?

1

There are 1 best solutions below

0
On

I'm not sure whether to post this as an answer or not, but it is at least a resolution. After spending a day and a half of snooping through source code and trying various experiments, I gave up, removed the 64-bit Strawberry 5.28.1, and installed 32-bit Strawberry 5.28.1. Then true built, tested, and installed like a champ.

My only guess (and it's a wild guess) is that some part of the process was somehow finding and interacting with some 32-bit binaries on the network— although I expressly did not have PERL5LIB or other Perl env vars set, and nothing in my PATH pointed to any network Perl stuff.

But I don't have time to investigate this any further, and 32-bit Perl is good enough for what I do. A big thank you to @Corion and @ikegami for their time and comments.