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.40 cpan | Win32::Console::ANSI failing #185

Open
shawnlaffan opened this issue May 25, 2024 · 10 comments
Open

perl 5.40 cpan | Win32::Console::ANSI failing #185

shawnlaffan opened this issue May 25, 2024 · 10 comments
Labels

Comments

@shawnlaffan
Copy link
Contributor

shawnlaffan commented May 25, 2024

Win32::Console::ANSI is failing many of its tests when building perl 5.40 RC1, and also 3.39.10.

This might be related to the build machine which is different to the one used for the 5.38 and 5.36 releases. The main difference is Windows 11 vs Windows 10.

These builds of perl also use UCRT instead of MSVCRT.

CPAN testers has many fails but not the same set of tests. http://matrix.cpantesters.org/?dist=Win32-Console-ANSI+1.11

Is anyone else able to reproduce these errors?

--> Working on Win32::Console::ANSI
Fetching https://cpan.metacpan.org/authors/id/J/JL/JLMOREL/Win32-Console-ANSI-1.11.tar.gz ... OK
Configuring Win32-Console-ANSI-1.11 ... Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for Win32::Console::ANSI
Writing MYMETA.yml and MYMETA.json
Checking dependencies from MYMETA.json ...
Checking if you have Win32::Pipe 0 ... Yes (0.025)
Checking if you have Win32::Process 0 ... Yes (0.17)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.70)
OK
Building and testing Win32-Console-ANSI-1.11 ... "C:\strawberry\perl\bin\perl.exe" "C:\strawberry\perl\lib\ExtUtils/xsubpp"  -typemap C:\strawberry\perl\lib\ExtUtils\typemap -typemap C:\strawberry_build\env\AppDataRoaming\.cpanm\work\1716599122.14244\Win32-Console-ANSI-1.11\typemap  ANSI.xs > ANSI.xsc
Running Mkbootstrap for ANSI ()
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"Win32::Console::ANSI\", 'DLBASE' => 'ANSI', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
cp lib/Win32/Console/ANSI.pm blib\lib\Win32\Console\ANSI.pm
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 644 "ANSI.bs"
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command -e mv -- ANSI.xsc ANSI.c
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- ANSI.bs blib\arch\auto\Win32\Console\ANSI\ANSI.bs 644
gcc -c  -I. -std=c99 -DWIN32 -DWIN64 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bitfields -Os   -DVERSION=\"1.11\" -DXS_VERSION=\"1.11\"  "-IC:\strawberry\perl\lib\CORE"   ANSI.c
In file included from ANSI.xs:8:
ppport.h:3042: warning: "PERL_UNUSED_DECL" redefined
 3042 | #  define PERL_UNUSED_DECL
      | 
In file included from ANSI.xs:5:
C:\strawberry\perl\lib\CORE/perl.h:539: note: this is the location of the previous definition
  539 | #  define PERL_UNUSED_DECL __attribute__unused__
      | 
g++ ANSI.def -o blib\arch\auto\Win32\Console\ANSI\ANSI.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\13.2.0" ANSI.o   "C:\strawberry\perl\lib\CORE\libperl540.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\Win32\Console\ANSI\ANSI.xs.dll
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonempty -- ANSI.bs blib\arch\auto\Win32\Console\ANSI\ANSI.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_Pod.t ............. ok
t/01_PodCoverage.t ..... ok
t/02_CursorFunc.t ...... ok
t/03_CursorMove.t ...... 
Failed 7/98 subtests 
t/04_DisplayEdition.t .. 
Failed 41/74 subtests 
t/05_Colors.t .......... 
Failed 35/37 subtests 
t/06_Func.t ............ ok
t/07_TortureMeHoney.t .. 
Failed 2/3 subtests 
t/08_Compatibility.t ... 
Failed 2/3 subtests 
t/09_Compatibility2.t .. skipped: Term::ANSIScreen not installed
t/99_Kwalitee.t ........ skipped: these tests are for release candidate testing

Test Summary Report
-------------------
t/03_CursorMove.t    (Wstat: 0 Tests: 98 Failed: 7)
  Failed tests:  1, 11, 22, 31, 40, 50, 58
t/04_DisplayEdition.t (Wstat: 0 Tests: 74 Failed: 41)
  Failed tests:  3, 6, 9, 12, 14, 17-29, 33, 35, 43, 45
                53-71
t/05_Colors.t        (Wstat: 0 Tests: 37 Failed: 35)
  Failed tests:  1-34, 36
t/07_TortureMeHoney.t (Wstat: 0 Tests: 3 Failed: 2)
  Failed tests:  1-2
t/08_Compatibility.t (Wstat: 0 Tests: 3 Failed: 2)
  Failed tests:  2-3
Files=11, Tests=278,  6 wallclock secs ( 0.03 usr +  0.01 sys =  0.05 CPU)
Result: FAIL
Failed 5/11 test programs. 87/278 subtests failed.
gmake: *** [makefile:1037: test_dynamic] Error 255
! Installing Win32::Console::ANSI failed. See C:\strawberry_build\env\AppDataRoaming\.cpanm\work\1716599122.14244\build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'Win32::Console::ANSI' is not installed
@shawnlaffan
Copy link
Contributor Author

Win32::Console::ANSI is a dependency of Data::Printer.

@shawnlaffan
Copy link
Contributor Author

A portable Strawberry Perl 5.40-RC1 can be downloaded from https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/tag/dev_5.40.0_RC1_UCRT

@sisyphus
Copy link

These builds of perl also use UCRT instead of MSVCRT.

I think it could well be that Win32::Console::ANSI needs some amendment in order to accommodate UCRT.
When I use SP's 5.39.10 (MSVCRT) to build Win32::Console::ANSI, I get the following test report:

Test Summary Report
-------------------
t/04_DisplayEdition.t (Wstat: 0 Tests: 74 Failed: 23)
  Failed tests:  1-3, 5-6, 8-9, 11-12, 14, 17-29
Files=11, Tests=278,  4 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
Result: FAIL
Failed 1/11 test programs. 23/278 subtests failed.
gmake: *** [makefile:1037: test_dynamic] Error 255

When I use my own 5.39.10 (UCRT) to build Win32::Console::ANSI, I get this test report:

Test Summary Report
-------------------
t/03_CursorMove.t    (Wstat: 0 Tests: 98 Failed: 7)
  Failed tests:  1, 11, 22, 31, 40, 50, 58
t/04_DisplayEdition.t (Wstat: 0 Tests: 74 Failed: 41)
  Failed tests:  3, 6, 9, 12, 14, 17-29, 33, 35, 43, 45
                53-71
t/05_Colors.t        (Wstat: 0 Tests: 37 Failed: 35)
  Failed tests:  1-34, 36
t/07_TortureMeHoney.t (Wstat: 0 Tests: 3 Failed: 2)
  Failed tests:  1-2
t/08_Compatibility.t (Wstat: 0 Tests: 3 Failed: 2)
  Failed tests:  2-3
Files=11, Tests=277,  3 wallclock secs ( 0.02 usr +  0.00 sys =  0.02 CPU)
Result: FAIL
Failed 5/11 test programs. 87/277 subtests failed.
make: *** [makefile:1039: test_dynamic] Error 255

I get the same report on all of my UCRT builds of perl going back to 5.39.2 (when I first started using the UCRT compiler).
And it's the same with my Visual Studio builds (which, I believe, also use UCRT).
When I go back to my own build of perl-5.38.0, which was built with an MSVCRT compiler, I get the same report as given by SP's 5.39.10 MSVCRT build.

Who among us has the expertise to deal with this ?

Incidentally, I notice that the additional ccflags that were added to SP-5.38.2 (via the "OPTIMIZE" spec) are no longer present.
Is that intended ?
(I've no advice to offer on whether they should go or stay.)

@shawnlaffan
Copy link
Contributor Author

It could also be that the windows console has changed and the module needs to be updated. Both my tests were on Win 11, FWIW. I'll try on a windows 10 machine when I get a chance.

Incidentally, I notice that the additional ccflags that were added to SP-5.38.2 (via the "OPTIMIZE" spec) are no longer present.
Is that intended ?

Thanks for spotting that. They will be in the next version.

@xenu
Copy link

xenu commented May 26, 2024

I haven't investigated the t/04_DisplayEdition.t failure yet, but all the other failures are indeed caused by UCRT.

There's a ticket with a patch: https://rt.cpan.org/Public/Bug/Display.html?id=132827

However, the patch is broken (it segfaults because it uses tolower incorrectly). Here's a fixed version:
fixed.patch

@shawnlaffan
Copy link
Contributor Author

shawnlaffan commented May 26, 2024

Thanks @xenu. That patch works as described.

If we can get t/04_DisplayEdition to work then that would be great, but for now we can build a patched version for SP 5.40.

@sisyphus
Copy link

Yep - @xenu's patch fixes the new failures on perls built with gcc-13 or (presumably) earlier.
For perl's built with gcc-14, we apparently need a BOOL isMSVC(PSTR mod); protoype (which I inserted just below the #include "XSUB.h" line in ANSI.xs.
Otherwise, with gcc-14, I got hammered with:

ANSI.xs:291:14: error: implicit declaration of function 'isMSVC' [-Wimplicit-function-declaration]
  291 |         if ( isMSVC(me.szModule) ) {

(Unless my eyes deceived me, we don't even get a warning about that with gcc-13.)

@shawnlaffan
Copy link
Contributor Author

Thanks @sisyphus. I've added that to the locally patched version.

@shawnlaffan
Copy link
Contributor Author

shawnlaffan commented May 26, 2024

I've uploaded the patched version to https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/tag/patched_cpan_modules

Installation can use the usual idiom for one's favourite CPAN client, which for cpanm is:

cpanm https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/patched_cpan_modules/Win32-Console-ANSI-1.11_001.tar.gz

Or, given there is still one failing test:

cpanm --notest https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/patched_cpan_modules/Win32-Console-ANSI-1.11_001.tar.gz

@shawnlaffan
Copy link
Contributor Author

I still have not worked out what the failing test actually tests, and therefore if it matters.

Data::Printer is the only reverse dep I am aware of that is part of Strawberry Perl.

A quick check with Data::Printer using older versions of Strawberry Perl suggests the output has not commonly been coloured anyway, at least not in a Cmd prompt.

Given that I'll skip the failing test in the build process.

A caveat is that the list of reverse deps on metacpan is incomplete given D::P is not present, so there may be other conditional deps.

@shawnlaffan shawnlaffan added the upstream module Issue is due to an upstream module label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants