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

[Win32 gcc-13.1.0] PDL-2.082/Basic/Math/cpoly.c fails to compile #434

Closed
sisyphus opened this issue Apr 29, 2023 · 3 comments
Closed

[Win32 gcc-13.1.0] PDL-2.082/Basic/Math/cpoly.c fails to compile #434

sisyphus opened this issue Apr 29, 2023 · 3 comments

Comments

@sisyphus
Copy link
Contributor

The following patch (to PDL-2.082/Basic/Math/Makefile.PL) allows PDL-2.082/Basic/Math/cpoly.c to compile on 64-bit and 32-bit builds of perl-5.37.11 that were built using mingw-w64 ports of gcc-13.1.0.
The latest version of gcc is gcc-13.1.0, and the latest (development) release of perl is 5.37.11.
I have tested the patch on both 32-bit and 64-bit perl builds where it works fine,
I know that it is needed for the 64-bit build, though I haven't checked to see whether it is actually needed for the 32-bit builds:

> diff -u Makefile.PL_orig Makefile.PL
--- Makefile.PL_orig    2022-02-14 21:02:23.000000000 +1100
+++ Makefile.PL 2023-04-29 17:57:59.256785600 +1000
@@ -129,6 +129,12 @@

 $hash{LIBS}->[0] .= " $libs";

+# mingw-w64 ports of gcc-13.1 altered the default Intel syntax,
+# and thereby introduced or exposed a bug. So we work around
+# the problem by specifying the original default in CCFLAGS
+if($^O =~/MSWin32/i && $Config::Config{cc} =~ /\bgcc/i) {
+   $hash{CCFLAGS} = $Config::Config{ccflags} . ' -masm=att';
+}
 undef &MY::postamble; # suppress warning
 *MY::postamble = sub {
        pdlpp_postamble_int(@pack);

There's a discussion about the need for this at:
https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/CADZSBj2PDJj1E64zWeWUeZ%3DrvRj7_ETbHxb6p1pBKg-rf9BJ5Q%40mail.gmail.com/#msg37836780

That discussion relates to a recent gcc-13.0.1 pre-release, but the same issue arises with gcc-13.1.0.

Earlier versions of gcc, don't need the patch because they already default to "att".
Explicitly specifying "att" should therefore make no difference - but I've tested that only with gcc-12.2.0 as gcc-11 and earlier seem to be unable to build PDL-2.082 on Windows for other reasons.

Thoughts ?

Cheers,
Rob

@sisyphus
Copy link
Contributor Author

sisyphus commented May 1, 2023

Turns out that, although this patch is needed when using LH_Mouse's build of gcc-13.1.0, it is not needed when using the build of gcc-13.1.0 provided by https://winlibs.com.
It's just a personal preference of LH_Mouse

I generally use the latter, and so does Strawberry Perl. I don't know of anyone (other than myself) having used LH_Mouse's build.
Application of this patch is therefore generally unnecessary.
I'm happy enough for this issue to be closed, and I will do so, if requested.
OTOH, applying the patch will not create problems with those mingw-w64 ports of gcc that don't need it.

Cheers,
Rob.

@mohawk2
Copy link
Member

mohawk2 commented May 1, 2023

Could you make it a PR? I'll be happy to merge it

@mohawk2
Copy link
Member

mohawk2 commented May 28, 2023

Is this still needed at all?

@mohawk2 mohawk2 closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants