Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl 5.36 cpan | bareword::filehandles build fails #76

Closed
shawnlaffan opened this issue Mar 14, 2023 · 7 comments
Closed

perl 5.36 cpan | bareword::filehandles build fails #76

shawnlaffan opened this issue Mar 14, 2023 · 7 comments

Comments

@shawnlaffan
Copy link
Contributor

bareword::filehandles is failing to build. See log below from a cpanm --look call as the main logs have other logging details interleaved.

This happens on the docker image as well as a local machine.

The module is needed for Alt::Crypt::RSA::BigInt, Crypt::CBC and Crypt::OpenPGP.

C:\spbuild\msys64\.cpanm\work\1678785245.2456\bareword-filehandles-0.007>perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for bareword::filehandles
Writing MYMETA.yml and MYMETA.json

C:\spbuild\msys64\.cpanm\work\1678785245.2456\bareword-filehandles-0.007>gmake
cp lib/bareword/filehandles.pm blib\lib\bareword\filehandles.pm
Running Mkbootstrap for filehandles ()
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "filehandles.bs"
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- filehandles.bs blib\arch\auto\bareword\fileh
andles\filehandles.bs 644
"C:\strawberry\perl\bin\perl.exe" "C:\strawberry\perl\lib\ExtUtils/xsubpp"  -typemap C:\strawberry\perl\lib\ExtUtils\typ
emap  filehandles.xs > filehandles.xsc
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- filehandles.xsc filehandles.c
gcc -c  -IC:\strawberry\perl\vendor\lib\B\Hooks\OP\Check\Install -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMOD
E_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bit
fields -O2   -DVERSION=\"0.007\" -DXS_VERSION=\"0.007\"  "-IC:\strawberry\perl\lib\CORE"   filehandles.c
filehandles.xs:10: warning: "PERL_VERSION_GE" redefined
   10 | #define PERL_VERSION_GE(r,v,s) \
      |
In file included from C:\strawberry\perl\lib\CORE/perl.h:2999,
                 from filehandles.xs:2:
C:\strawberry\perl\lib\CORE/handy.h:553: note: this is the location of the previous definition
  553 | # define PERL_VERSION_GE(j,n,p)  (! PERL_VERSION_LT(j,n,p))
      |
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"bareword::filehandles\", 'DLBASE' => 'filehandles', 'DL_FUNCS' => {  }, 'FUNCLIST' => [],
'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ filehandles.def -o blib\arch\auto\bareword\filehandles\filehandles.xs.dll -shared -s -L"C:\strawberry\perl\lib\CORE"
 -L"C:\strawberry\c\lib" -L"C:\strawberry\c\x86_64-w64-mingw32\lib" -L"C:\strawberry\c\lib\gcc\x86_64-w64-mingw32\10.3.0
" filehandles.o   "C:\strawberry\perl\lib\CORE\libperl536.a" -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg3
2 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomct
l32 -Wl,--enable-auto-image-base
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: filehandles.o:fileha
ndles.c:(.text+0x44f): undefined reference to `hook_op_check'
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: filehandles.o:fileha
ndles.c:(.text+0x463): undefined reference to `hook_op_check'
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: filehandles.o:fileha
ndles.c:(.text+0x477): undefined reference to `hook_op_check'
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: filehandles.o:fileha
ndles.c:(.text+0x48b): undefined reference to `hook_op_check'
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: filehandles.o:fileha
ndles.c:(.text+0x49f): undefined reference to `hook_op_check'
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: filehandles.o:fileha
ndles.c:(.text+0x4b3): more undefined references to `hook_op_check' follow
collect2.exe: error: ld returned 1 exit status
gmake: *** [makefile:482: blib\arch\auto\bareword\filehandles\filehandles.xs.dll] Error 1
@sisyphus
Copy link

sisyphus commented Mar 14, 2023

I see the same on my own builds. I think the issue has probably been around for a while but no-one has been building this module on Windows.
The failing command (that tries to create filehandles.dll) needs to additionally link to : perl\site\lib\auto\B\Hooks\OP\Check\Check.dll

I was able to get the build to complete by manually re-running that failing command, having first inserted
-L"D:\perl-5.36.0\site\lib\auto\B\Hooks\OP\Check" -lCheck
just before the occurrence of "filehandles.o".

But there's surely a better way of linking to perl\site\lib\auto\B\Hooks\OP\Check\Check.dll .

Anyone know what that "better way" (or preferably "best way") might be ?

Update: BTW, after the successful build, the tests also passed:

t/00-report-prereqs.t .. ok
t/basic.t .............. ok
All tests successful.
Files=2, Tests=483,  1 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
Result: PASS

Cheers,
Rob

@shawnlaffan
Copy link
Contributor Author

Thanks Rob.

I assume the CFLAGS env var is the more general means of implementing this?

The build system uses cpanm, and can be passed env vars per distribution.

Although now I also see there are option to pass arguments to the makefile configure stage so that would probably be cleaner.

push @args, '--configure-args', ($a{buildpl_param} || $a{makefilepl_param}) if $a{makefilepl_param} || $a{buildpl_param};

@sisyphus
Copy link

The build system uses cpanm, and can be passed env vars per distribution.

This is territory that I'm not particularly familiar with.
In my own windows builds, I can partly solve the problem by adding the location of Check.dll to the LIBRARY_PATH environment variable.
Having done that, building bareword::filehandles the old fashioned way by hand should be as simple as:

perl Makefile.PL LIBS=-lCheck
gmake test
gmake install

And I think that would work fine if not for the fact that braindead EU::MM wrongly decides that -lCheck will not be found ... and then ever-so-helpfully removes that crucial link.

So I still need to manually re-run the failing command, but now I need only to first add the "-lCheck" link to it.
Not sure how to get around that. But that doesn't matter ... the important thing is that @shawnlaffan knows how to deal with it.

Of course, on Strawberry Perl, "Check.dll" will presumably be called "Check.xs.dll".

Cheers,
Rob

@shawnlaffan
Copy link
Contributor Author

... the important thing is that @shawnlaffan knows how to deal with it

Well I can see a means to implement it if someone gives me the correct invocation...

@shawnlaffan
Copy link
Contributor Author

I've also reported it upstream: https://rt.cpan.org/Ticket/Display.html?id=147149

@sisyphus
Copy link

Well I can see a means to implement it if someone gives me the correct invocation...

I can do it, using cpanm after having added the location of Check.xs.dll to the LIBRARY_PATH environment variable.
All I then have to do is to run cpanm -i bareword::filehandles --configure-args="LDDLFLAGS=<ARG>" where <ARG> is just $Config{lddlflags} with " -lCheck.xs" appended to it.
This is with sp536_20230311, and LIBRARY_PATH set to C:\strawberry\perl\vendor\lib\auto\B\Hooks\OP\Check

C:\strawberry>cpanm -vi bareword::filehandles --configure-args="LDDLFLAGS=\"-shared -s -LC:/strawberry/perl/lib/CORE -LC:/strawberry/c/lib -LC:/strawberry/c/x86_64-w64-mingw32/lib -LC:/strawberry\c/lib/gcc/x86_64-w64-mingw32/10.3.0 -lCheck.xs\""
cpanm (App::cpanminus) 1.7046 on perl 5.036000 built for MSWin32-x64-multi-thread
Work directory is C:\Users\Owner/.cpanm/work/1678854680.7096
You have make C:\strawberry\c\bin\gmake.exe
You have LWP 6.68
Falling back to Archive::Tar 2.40
Searching bareword::filehandles () on cpanmetadb ...
--> Working on bareword::filehandles
Fetching http://www.cpan.org/authors/id/I/IL/ILMARI/bareword-filehandles-0.007.tar.gz ... OK
Unpacking bareword-filehandles-0.007.tar.gz
Entering bareword-filehandles-0.007
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.66)
Checking if you have B::Hooks::OP::Check 0 ... Yes (0.22)
Checking if you have ExtUtils::Depends 0 ... Yes (0.8001)
Running Makefile.PL
Configuring bareword-filehandles-0.007 ... Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for bareword::filehandles
Writing MYMETA.yml and MYMETA.json
OK
Checking dependencies from MYMETA.json ...
Checking if you have Test::More 0.88 ... Yes (1.302193)
Checking if you have File::Spec 0 ... Yes (3.84)
Checking if you have if 0 ... Yes (0.0610)
Checking if you have B::Hooks::OP::Check 0 ... Yes (0.22)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.66)
Checking if you have warnings 0 ... Yes (1.58)
Checking if you have XSLoader 0 ... Yes (0.31)
Checking if you have strict 0 ... Yes (1.12)
Building and testing bareword-filehandles-0.007 ... cp lib/bareword/filehandles.pm blib\lib\bareword\filehandles.pm
Running Mkbootstrap for filehandles ()
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "filehandles.bs"
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- filehandles.bs blib\arch\auto\bareword\filehandles\filehandles.bs 644
"C:\strawberry\perl\bin\perl.exe" "C:\strawberry\perl\lib\ExtUtils/xsubpp"  -typemap C:\strawberry\perl\lib\ExtUtils\typemap  filehandles.xs > filehandles.xsc
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- filehandles.xsc filehandles.c
gcc -c  -IC:\strawberry\perl\vendor\lib\B\Hooks\OP\Check\Install -DWIN32 -DWIN64 -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -O2   -DVERSION=\"0.007\" -DXS_VERSION=\"0.007\"  "-IC:\strawberry\perl\lib\CORE"   filehandles.c
filehandles.xs:10: warning: "PERL_VERSION_GE" redefined
   10 | #define PERL_VERSION_GE(r,v,s) \
      |
In file included from C:\strawberry\perl\lib\CORE/perl.h:2999,
                 from filehandles.xs:2:
C:\strawberry\perl\lib\CORE/handy.h:553: note: this is the location of the previous definition
  553 | # define PERL_VERSION_GE(j,n,p)  (! PERL_VERSION_LT(j,n,p))
      |
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"bareword::filehandles\", 'DLBASE' => 'filehandles', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ filehandles.def -o blib\arch\auto\bareword\filehandles\filehandles.xs.dll -shared -s -LC:/strawberry/perl/lib/CORE -LC:/strawberry/c/lib -LC:/strawberry/c/x86_64-w64-mingw32/lib -LC:/strawberry\c/lib/gcc/x86_64-w64-mingw32/10.3.0 -lCheck.xs filehandles.o   "C:\strawberry\perl\lib\CORE\libperl536.a" -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -Wl,--enable-auto-image-base
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 755 blib\arch\auto\bareword\filehandles\filehandles.xs.dll
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- filehandles.bs blib\arch\auto\bareword\filehandles\filehandles.bs 644
"C:\strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/00-report-prereqs.t .. #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
#     Module              Want   Have
#     ------------------- ---- ------
#     B::Hooks::OP::Check  any   0.22
#     ExtUtils::Depends    any 0.8001
#     ExtUtils::MakeMaker  any   7.66
#
# === Build Requires ===
#
#     Module     Want     Have
#     ---------- ---- --------
#     Test::More 0.88 1.302193
#
# === Test Requires ===
#
#     Module              Want     Have
#     ------------------- ---- --------
#     ExtUtils::MakeMaker  any     7.66
#     File::Spec           any     3.84
#     Test::More          0.88 1.302193
#
# === Test Recommends ===
#
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.150010
#
# === Runtime Requires ===
#
#     Module              Want   Have
#     ------------------- ---- ------
#     B::Hooks::OP::Check  any   0.22
#     XSLoader             any   0.31
#     if                   any 0.0610
#     strict               any   1.12
#     warnings             any   1.58
#
t/00-report-prereqs.t .. ok
t/basic.t .............. ok
All tests successful.
Files=2, Tests=483,  1 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
Result: PASS
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- filehandles.bs blib\arch\auto\bareword\filehandles\filehandles.bs 644
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree
Installing C:\strawberry\perl\site\lib\auto\bareword\filehandles\filehandles.xs.dll
Installing C:\strawberry\perl\site\lib\bareword\filehandles.pm
Appending installation info to C:\strawberry\perl\lib/perllocal.pod
OK
Successfully installed bareword-filehandles-0.007
Installing C:\strawberry\perl\site\lib\MSWin32-x64-multi-thread\.meta\bareword-filehandles-0.007\install.json
Installing C:\strawberry\perl\site\lib\MSWin32-x64-multi-thread\.meta\bareword-filehandles-0.007\MYMETA.json
1 distribution installed

HTH.
Cheers,
Rob

@shawnlaffan
Copy link
Contributor Author

Fixed by e5a3732.

See #80 for discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants