-
Notifications
You must be signed in to change notification settings - Fork 49
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 | PDL build fails #93
Comments
PDL 2.078 does not segfault when running
|
PDL 2.080 also seg faults. Edit: And 2.079. |
@mohawk2 - fyi. See previous posts in this issue for errors and link to Strawberry perl 5.36 for testing. |
Thank you for letting me know. This works fine on Strawberry 5.32 here with PDL 2.081_03, so if this is caused by a problem in PDL, you're going to need to build PDL with Also, please ensure that all of PDL's deps are up to date, especially Text::Balanced, which will probably be what's breaking NiceSlice. |
I built PDL with It does not segfault and produces the expected output. As noted in an earlier comment, but easy to miss, a perl 5.36 to test with is at https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/tag/dev_20230420 Also, |
@shawnlaffan Is the GCC 10.3, the latest that's available in MinGW? I note that GCC proper is at version 13. @HaraldJoerg has been working hard on helping me understand why this is happening; turning optimisation off makes it work. FYI it's just the For context, this isn't the first time compiler bugs have affected PDL; it won't compile on BSDs which have an older clang, which crashes; and there are a few uses of |
No, there are later versions available through winlibs. However, we ran into some issues with later versions and found 10.3 to be the least problematic for the moment. |
That's a real pity. |
Can you say how to get a later winlibs and drop it in as a replacement for the 10.3? Also, can you give an indication of what kind of problems were encountered? |
@mohawk2 - See discussion starting from #56 (comment) |
We have been using 10.3 as that seems to be the latest winlibs gcc10 that does not depend on UCRT or MSCVRT. Of course, if MSVCRT is what we want and it's just a labelling change then we can start using those (and I can adjust my levels of ignorance about such matters). WRT GCC 11 and later, I think there are patches that have been introduced to Perl 5.37 that would need to be backported. Or maybe it was only GCC 12: https://github.com/Perl/perl5/issues?q=is%3Aissue+is%3Aclosed+%22GCC+11%22+author%3Ahakonhagland |
Note that the 5.36.0 GNUmakefile sets perl's optimization to
MSVCRT (which is what mingw-w64 compilers have traditionally used) is definitely what you want. EDIT: disregard the following remark. It occurs to me that I don't really know how well the "patched" perl-5.36.0 source will go when built using gcc-12.2.0, as I haven't actually tested: With PDL-2.082, I get those niceslice failures you've mentioned on my own (patched) perl-5.36.0 (gcc-11.3.0), but the same PDL source builds and tests just fine on perl-5.37.11 (gcc-12.2.0). Not so good with perl-5.37.11 (gcc-13.0.1) where PDL-2.082 fails to compile:
@mohawk2 - let me know if you want me to file a separate PDL bug report about this. (I don't think it should be discussed here .... probably should not even have been mentioned here ;-) Cheers, |
@sisyphus Please do file a specific bug report if it will make PDL more compatible! Even better, a pull request :-) |
Thanks @sisyphus Comments for general input are below.
So we Strawberry perl is best built with -Os? Hopefully this is just a case of updating the GNUMakefile before building. (Edit 2 - updated link to correct location). And if GCC 12.2 is best avoided for now, per Rob's edited comment, then we need to decide which version to use. I assume the latest GCC 11? Also, the current list of patches and updates for 5.36 are in the build script. If more are needed then they can be added pretty easily (whether they apply cleanly is a different question). Perl-Dist-Strawberry/share/64bit-5.36.0.1.pp Lines 107 to 134 in 5ba3b2a
Edit: The patch files themselves live under https://github.com/StrawberryPerl/Perl-Dist-Strawberry/tree/wip_536/share/perl-5.36 |
Yep. I think that's safest. (And updating the GNUmakefile as you indicated is all that's needed.)
I shouldn't really be making any suggestions about that all. When it comes to 5.38.0 (next month), I feel that I can legitimately recommend 12.2.0 - having tested perl against that compiler throughout the 5.37 dev cycle. (Even then, there's a lot of "vendor" modules that I haven't built or tested.) Cheers, |
Thanks Rob. Unless there are views otherwise I will have a go building extlibs and perl 5.36.0 with GCC 11.3.0 tomorrow. Link from https://winlibs.com/ is https://github.com/brechtsanders/winlibs_mingw/releases/download/11.3.0-14.0.3-10.0.0-msvcrt-r3/winlibs-x86_64-posix-seh-gcc-11.3.0-mingw-w64msvcrt-10.0.0-r3.zip |
I'd like to know how these post-10.3 versions of GCC do compiling PDL. If they're fine, then we don't need to investigate fixing PDL anymore. |
On Thu, Apr 27, 2023 at 3:44 PM mohawk2 ***@***.***> wrote:
I'd like to know how these post-10.3 versions of GCC do compiling PDL. If
they're fine, then we don't need to investigate fixing PDL anymore.
Seems reasonable.
I'll see how PDL-2.082 fares on perl-5.37.11 built using the following 3
compilers:
gcc-11.3.0
gcc-12.2.0
gcc-13.0.1
and report back. Might take a few hours as I don't have an 11.3.0 build of
perl-5.37.11 at hand.
All builds will be MSWin32-x64-multi-thread.
Cheers,
Rob
|
I've built by simply running With gcc-12.2.0, runtime version 10, all goes well with PDL - which passes the test suite and is installed without issue. With gcc-11.3.0, runtime version 10, PDL builds ok but the test suite stops just after it starts:
I also built perl-5.37.11 with gcc-10.3.0, runtime version 9 and had a crack at building PDL-2.082 on it, too. Cheers, |
As another data point, I bisected PDL between 2.078 and 2.079. It begins to fail after commit 51a5bf87. However, this is most probably not helping: That change is in the relevant source (pdlapi.c), but the change is in function |
That says compiler bug to me. |
@sisyphus and @HaraldJoerg - did you compile PDL with Although the errors @sisyphus is seeing in the niceslice tests are the same as I get for 10.3, although I have not yet built a perl with |
Yes, the patch to GNUmakefile was applied to the 5.37 releases a few months ago and has apparently been backported to the 5.36.1 release. IIUC the issue with gcc-13.0.1 and PDL is probably an A workaround is provided therein - though I'll probably create an issue with PDL suggesting that any potentially clashing symbols in cpoly.c (such as "shr") be renamed. Cheers, |
1 similar comment
Yes, the patch to GNUmakefile was applied to the 5.37 releases a few months ago and has apparently been backported to the 5.36.1 release. IIUC the issue with gcc-13.0.1 and PDL is probably an A workaround is provided therein - though I'll probably create an issue with PDL suggesting that any potentially clashing symbols in cpoly.c (such as "shr") be renamed. Cheers, |
It's in 5.37.x, but was not backported to 5.36.1. If the errors don't occur when using |
Right you are. At this stage, all of my perl-5.36.1 configurations have been built using gcc-12.2.0, runtime version 10. So, we see the same PDL-2.082 test errors (niceslice) for: Yet gcc-12.2.0, rt 10, -Os builds and tests PDL-2.082 fine with perl-5.37.11 (apart from the subsequent failure to build OPenGL). There's no obvious (to me) conclusion to draw from that. I'm curious to see how PDL-2.082 goes on perl-5.37.11, gcc-13.01. rt 11, -Os when I get past the assembler errors. Then we can maybe get a better idea of which compiler to use. Cheers, |
I'm very happy to rename any variables that are triggering bugs. @sisyphus Please either make a PR, or open an issue (or say here) with what turns it from failing to succeeding :-) |
Thanks @sisyphus for the diagnoses. Just to double check, you report PDL as building with gcc 12.2 in #93 (comment) but was that for perl 5.37? You note that it fails for perl 5.36.1 across gcc versions in #93 (comment) Also, which were for the winlibs variants? That is the source we are using for Strawberry perl. |
@mohawk2: I think it's the list in https://sourceware.org/bugzilla/show_bug.cgi?id=12240#c1 (accessed via the sourceware.org links at the end of the bug report linked to above ). @sisyphus please correct me if this is wrong. |
Yes, for perl-5.37.11. (I've just double-checked this.)
Yes - it's the niceslice failure.
All non-13.0.1 compilers are winlibs. The links (that you've just posted) to my discussion with mingw-w64 developers re the compilation of PDL/Math/Basic/cpoly.c are correct. Cheers, |
Thanks again Rob. As a general discussion point for all: It would seem gcc 13.1 is the way to go since it builds PDL? (once the issue in PDLPorters/pdl#434 has been resolved). There are caveats. (1) Rob has not reported building 5.36.x with gcc 13, at least not in this issue? And (2) there is the risk that gcc 13 tickles some other novel bugs in the extlibs... Edit - that also still leaves the OpenGL failures but I've been leaving them be for now as PDL is a higher priority. |
I was thinking of it as (maybe) a candidate for 5.38, rather than for 5.36. Use of gcc-13 to build 5.38 is already going to require patches specified in Perl/perl5#21038 and Perl/perl5#21039 - though the latter is not mandatory for 64-bit builds. Then there's another liittle issue with gcc-13.1 and PDL.
I was about to raise an issue on the PDL list late last, including this patch but then I thought "hang on ... I should probably first make sure that the capability for gcc-13 to resolve those undefined references does not exist." In any case that nameclash between perl's util.h and gcc-13's ncurses/curses.h should be resolved - which will probably be achieved via a patch to util.h (and perhaps other files in the perl-5.37.11/5.38.0 source). I wonder what other yet-to-be-discovered issues with gcc-13 are lurking there. gcc-12.2 is probably a good candidate for perl-5.38 as no patching of the perl source will be needed. Neither 10.3.0 nor 11.3.0 nor 12.2.0 will currently build PDL on perl-5.36.1 - without any clear notion of when or how that PDL issue will be resolved. It looks to me that you might as well just test the waters with an official release of perl-5.36.1 (MSWin32-x64-multi-thread only), and see what issues are thrown up by users. Get it out there, and see what the feedback is. I've just embarked upon building 64-bt perl-5.36.1 (MSWin32-x64-multi-thread) with gcc-13.1, using the same 5.36.1 source as I've used for the other builds, plus the one line insertion in GNUmakefile that copies libmcfgthread-1.dll to the t directory. Cheers, |
Thanks Rob. Your point regarding perl 5.36 and gcc-13 is well made. That said, we are already patching in some of the 5.37 code changes. If only a small number are needed, and they apply cleanly, then we can seriously consider gcc-13.1 for 5.36. Not being able to build PDL is something of a show-stopper for me upgrading my own perl to 5.36. A lot of my code depends on PDL. The PDL errors might be a compiler bug but the fact they manifest with three major gcc versions (10, 11, 12) makes me wonder if the problem (or solution/workaround) might lie with PDL. |
Well ... my build of 64-bit perl-5.36.1 using gcc-13.1.0 went fine, with all tests passing. I guess the fact that there's a problem with perl C/XS files that want to Anyway, I want to concentrate now on finding the correct fix to that IO/Browser problem. BTW, winlibs now have gcc-13.1.0 available for download from the website. Cheers, |
The winlibs build of gcc-13.1.0 doesn't have curses.h anywhere. Cheers, |
Thanks Rob. I've started a docker container with gcc-13.1 so we'll see how it goes. I also have containers with gcc-11.3 and gcc-12.3 on the go building the extlibs. |
I just built perl-5.37.11 using winlibs 13.1.0 compiler. I'm also not going to worry about the issue with curses.h (which also afflicts only LH_Mouse's build) - since Curses is not really part of the gcc toolset and Strawberry Perl doesn't ship with libcurses. Cheers, |
Thanks Rob. For general info, the extlibs build across the winlibs gcc versions (11, 12, 13) with the exception of netcdf-4.9.0 and the need to upgrade to libiconv-1.17 from 1.15 (with patches from MSYS2). I'll file issues and PRs on the extlibs repo for those. Next is building perl 5.36.1 and the cpan libs. I'll hopefully get to that later today. Edit - actually, libunistring also has issues with gcc-12 and gcc-13. It looks like a threads linking issue and I'll post details to an extlibs issue. |
Issues on the build-extlibs repo: |
Coming back to this issue now that PDL 2.084 has been released. The issue can be reduced to an arithmetic combination of a PDL ndarray with a perl scalar. The first and third cases below work, the second and fourth seg fault.
To my untrained eye this looks more like a bug with how PDL is handling perl scalars than a compiler issue? |
Nice reduction, Shawn. AIUI, PDL is building fine in current blead,
Somewhere in the range 5.36.0 .. 5.37.4, this PDL issue goes away. Cheers, PS - I have no idea if this could prove to be relevant, but 5.37.1 updated ExtUtils::CBuilder with this fix:
|
Thanks Rob. The issue is definitely fixed for Perl 5.38. It would still be very useful if there were a fix so PDL builds under 5.36, either in PDL or in perl itself (for which 5.36 is still under maint). If there is a patch for perl 5.36 then we can look at applying it for the Strawberry builds. |
And FWIW, the Strawberry Perl build process checks and updates CPAN modules in core so the failing builds have all included that ExtUtils::CBuilder change. If your 5.36 builds don't run such an update then it is probably not related. |
Heh ... yeah, I looked at the CHANGES file for 0.280236 :-( Cheers, |
The segfault goes away when PDL is built on perl-5.37.2. The win32/vmem.h file is the same for both 5.36.0 and 5.36.1. Therefore, if that's the problem, then this patch to win32/vmem.h should suffice for both perl-5.36.0 and 5.36.1:
I'll try that out myself, shortly. I wish I had a better memory :-( Cheers, UPDATE: Using the new, improved win32/vmem.h with perl-5.36.1 enabled PDL-2.048 to build just fine, for me !! |
Much appreciated Rob. I've built a 5.36.1 with that patch in place. PDL passes its tests and the reproducer runs without seg faulting. I'll close this issue once I've pushed those changes to the wip_536 branch. A new dev release will follow soonish. |
This gets PDL to build. Fixes #93 Also update the libgd version so it passes tests.
Dev release that can build PDL is at https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/tag/dev_5361_20230524_gcc13 |
This might be an issue in PDL, or one of the modules it depends upon is not working correctly.
(Edit - tested with PDL 2.082).
The niceslice tests are failing but it is the
all
call that is segfaulting. GDB log is:Excerpt from the end of the build log:
The text was updated successfully, but these errors were encountered: