Skip Menu |

This queue is for tickets about the Math-Pari CPAN distribution.

Report information
The Basics
Id: 52146
Status: open
Priority: 0/
Queue: Math-Pari

People
Owner: Nobody in particular
Requestors: kmx [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Building Math::Pari on Win32/strawberry perl
Hi, please consider applying the enclosed patch that makes Math::Pari 2.01080602 installable on Win32/strawberry perl. Thanks. -- kmx
Subject: math-pari.patch
diff -r -u Math-Pari-2.01080602.orig/utils/Math/PariBuild.pm Math-Pari-2.01080602/utils/Math/PariBuild.pm --- Math-Pari-2.01080602.orig/utils/Math/PariBuild.pm 2009-11-08 11:21:06.000000000 +0100 +++ Math-Pari-2.01080602/utils/Math/PariBuild.pm 2009-11-28 11:18:31.708043800 +0100 @@ -37,7 +37,9 @@ use strict; use Config; use File::Copy 'copy'; +use File::Spec 'devnull'; use File::Basename 'basename'; +use ExtUtils::MakeMaker 'prompt'; =head1 NAME @@ -275,11 +277,9 @@ Make sure you have a large scrollback buffer to see the messages, or `tee' the STDOUT/STDERR to a file. -Fetch? (y/n, press Enter) EOP - chomp $mess; print "$mess "; - my $ans = <STDIN>; + my $ans = prompt "Fetch? (Y/n) ?", 'Y'; if ($ans !~ /y/i) { my ($eA, $eM, $tI, $tO, $tE, $pO, $pE) = (@ENV{ qw(AUTOMATED_TESTING PERL_MM_USE_DEFAULT) }, @@ -511,7 +511,7 @@ my ($rc, $p) = ''; my $patch = $Config{gnupatch} || 'patch'; foreach $p (@patches) { - my $cmd = "cd $dir ; $patch -p1 < ../$p"; + my $cmd = ($^O eq 'MSWin32') ? "cd $dir & $patch -p1 --binary < ..\\$p" : "cd $dir ; $patch -p1 < ../$p"; print "$cmd\n"; system "$cmd" and warn "...Could not patch: \$?=$?, $!; continuing anyway...\n"; @@ -860,6 +860,7 @@ sub find_machine_architecture () { my $os = (split ' ', $Config{myuname})[0]; + my $devnull = File::Spec->devnull(); my $machine = $os; # Handles fx2800 if ($os =~ /^irix/) { @@ -952,9 +953,9 @@ =~ /\b(sun3|sparcv7|sparcv8_micro|sparcv8_super|alpha|hppa|[ix]\d86)\b/) { $machine = $1; } elsif (not defined $machine) { - chomp($machine = `uname -m`); + chomp($machine = `uname -m 2>$devnull`); } - $machine =~ s/[ix]\d86/ix86/ if defined $machine; + $machine =~ s/[ix]\d86.*/ix86/ if defined $machine; print "...Processor of family `$machine' detected\n"; return $machine;
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 28 Nov 2009 03:04:12 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Nov 28, 2009 at 05:22:53AM -0500, kmx via RT wrote: Show quoted text
> please consider applying the enclosed patch that makes Math::Pari > 2.01080602 installable on Win32/strawberry perl.
a) I would prefer to avoid the dependence on more modules... b) What is `uname -m` on strawberry? Thanks, Ilya
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 28 Nov 2009 12:48:00 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Hi, Show quoted text
> a) I would prefer to avoid the dependence on more modules... >
OK, using File::Spec->devnull was just cosmetics hiding the error message. Show quoted text
> b) What is `uname -m` on strawberry? > >
Well, strawberry itself does not have uname at all, quite often people (like me) have installed uname from gnuwin32 which returns: i686-pc One more comment on strawberry's $Config{myuname} - before Oct2009 is $Config{myuname}empty - since Oct2009 release contains: Win32 strawberryperl 5.10.1.0 #1 30 i386 -- kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 28 Nov 2009 05:42:34 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Nov 28, 2009 at 06:48:38AM -0500, kmx via RT wrote: Show quoted text
> Queue: Math-Pari > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=52146 > > > Hi, >
> > a) I would prefer to avoid the dependence on more modules...
Show quoted text
> OK, using File::Spec->devnull was just cosmetics hiding the error message.
It'll work much better if I know which changes are needed, and which are cosmetic. For example, why --binary on patch? Is prompt() actually needed, and why? Show quoted text
> > b) What is `uname -m` on strawberry?
Show quoted text
> Well, strawberry itself does not have uname at all, quite often people > (like me) have installed uname from gnuwin32 which returns: > i686-pc
So without it, it would default to portable build? Likewise for patch? Show quoted text
> One more comment on strawberry's $Config{myuname} > - before Oct2009 is $Config{myuname}empty > - since Oct2009 release contains: > Win32 strawberryperl 5.10.1.0 #1 30 i386
If there were a chance to parse this... Thanks, Ilya
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 28 Nov 2009 17:14:59 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Hi, Show quoted text
> It'll work much better if I know which changes are needed, and which > are cosmetic. For example, why --binary on patch? Is prompt() > actually needed, and why? > >
a) absolutely crucial is "patch-part" - on Win32 the command separator is not ";" but "&" - patch option --binary is necessary for win32 patch to correctly process a *.patch file with UNIX-like newlines (= <LF>); without this option it fails as it expects <CR><LF> newlines - without applying patches the module is not installed correctly on Win32 b) as for the "prompt-part" - using prompt is AFAIK the recommended best-practice for cpan install scripts - your old code will ignore for example setting PERL_MM_USE_DEFAULT=1 - your old code will fail with most automated testing scripts as it has not a reasonable default Show quoted text
>> Well, strawberry itself does not have uname at all, quite often people >> (like me) have installed uname from gnuwin32 which returns: >> i686-pc >>
> So without it, it would default to portable build?
Yes. Show quoted text
>> One more comment on strawberry's $Config{myuname} >> - before Oct2009 is $Config{myuname}empty >> - since Oct2009 release contains: >> Win32 strawberryperl 5.10.1.0 #1 30 i386 >>
> If there were a chance to parse this... >
Not part of my patch but you can test e.g. if $machine variable contains "Win32" or you can test RE match $Config{myuname} =~ /strawberryperl.*?i386/ -- kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 28 Nov 2009 11:30:38 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Nov 28, 2009 at 11:15:22AM -0500, kmx via RT wrote: Show quoted text
> a) absolutely crucial is "patch-part" > - on Win32 the command separator is not ";" but "&"
Would && work? Show quoted text
> - patch option --binary is necessary for win32 patch to correctly > process a *.patch file with > UNIX-like newlines (= <LF>); without this option it fails as it > expects <CR><LF> newlines
Hmm, sounds like a misnomer. Without "binary mode", it should read in text mode, so do not care about line endings... Maybe there is --text option? Using --binary is a very dangerous choice. What if untar/unzip extracts with conversion of newlines? Show quoted text
> - without applying patches the module is not installed correctly on Win32
In which way? Show quoted text
> b) as for the "prompt-part" > - using prompt is AFAIK the recommended best-practice for cpan install > scripts > - your old code will ignore for example setting PERL_MM_USE_DEFAULT=1
Note the version 2.010805 and later... (Current one is 2.01080603) Show quoted text
> - your old code will fail with most automated testing scripts as it has > not a reasonable default
Not as experience shows... (At least from 2.010802) Show quoted text
> Not part of my patch but you can test e.g. if $machine variable contains > "Win32"
I already know this from $^O... Show quoted text
> or you can test RE match $Config{myuname} =~ /strawberryperl.*?i386/
I would probably test for SPACE whatever86 if `uname -m` fails... Thanks, Ilya
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 28 Nov 2009 20:57:22 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Show quoted text
>> - on Win32 the command separator is not ";" but "&" >>
> Would && work? >
Yes. Show quoted text
> Hmm, sounds like a misnomer. Without "binary mode", it should read in > text mode, so do not care about line endings... Maybe there is --text option? >
Unfortunately no --text option. It seems to be a feature of patch on Win32 system. Show quoted text
>> - without applying patches the module is not installed correctly on Win32 >>
> In which way? >
Apart from the errors when trying to run "uname" or "patch" I thought that there were some failing tests; but I have ran the installation again right now and it seems to install ok with all tests passed. So perhaps all this RT was not necessary :( -- kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Thu, 10 Dec 2009 17:21:40 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Nov 28, 2009 at 05:22:53AM -0500, kmx via RT wrote: Show quoted text
> please consider applying the enclosed patch that makes Math::Pari > 2.01080602 installable on Win32/strawberry perl.
I see - my $cmd = "cd $dir ; $patch -p1 < ../$p"; + my $cmd = ($^O eq 'MSWin32') ? "cd $dir & $patch -p1 --binary < ..\\$p" : "cd $dir ; $patch -p1 < ../$p"; This looks very strange to me, since $p contains slash... How comes? Yours, Ilya
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Thu, 10 Dec 2009 18:36:33 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Nov 28, 2009 at 05:22:53AM -0500, kmx via RT wrote: Show quoted text
> please consider applying the enclosed patch that makes Math::Pari > 2.01080602 installable on Win32/strawberry perl.
Could you check how 2.01080603 behaves? It is supposed to be better than what your patches did... Could you also check it with option version23_ok=1 to Makefile.PL (in a separate build directory)? Thanks, Ilya
Show quoted text
> - my $cmd = "cd $dir ; $patch -p1 < ../$p"; > + my $cmd = ($^O eq 'MSWin32') ? "cd $dir & $patch -p1 --binary < > ..\\$p" : "cd $dir ; $patch -p1 < ../$p"; > > This looks very strange to me, since $p contains slash... How comes?
You are right, backslashes are not necessary, you can use: my $cmd = ($^O eq 'MSWin32') ? "cd $dir & $patch -p1 --binary < ../$p" : "cd $dir ; $patch -p1 < ../$p"; -- kmx
Show quoted text
> Could you check how 2.01080603 behaves? It is supposed to be better > than what your patches did...
Unfortunately the install attempt ends like this: Looking for patches for 2.1.7... Patching... can't find file to patch at input line 3 Perhaps you should have used the -p or --strip option? The text leading up to this was: -------------------------- |--- utils/inc.h Tue Sep 25 07:17:18 2001 |+++ utils/inc.h1 Thu Dec 10 16:44:36 2009 -------------------------- File to patch: There is probably missing -p1 option when calling patch on Win32. -- kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Fri, 11 Dec 2009 10:53:32 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Fri, Dec 11, 2009 at 12:22:00PM -0500, kmx via RT wrote: Show quoted text
> Looking for patches for 2.1.7... > Patching... > can't find file to patch at input line 3 > Perhaps you should have used the -p or --strip option? > The text leading up to this was: > -------------------------- > |--- utils/inc.h Tue Sep 25 07:17:18 2001 > |+++ utils/inc.h1 Thu Dec 10 16:44:36 2009 > -------------------------- > File to patch:
Show quoted text
> There is probably missing -p1 option when calling patch on Win32.
Aha! Thanks for the suggestion. Could you manually add -p1 to line 510 of utils/Math/PariBuild.pm? I suspect one needs also to add ./ to file names inside utils/inc_h.diff ... Could you report? Thanks, Ilya
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Fri, 11 Dec 2009 10:56:02 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Fri, Dec 11, 2009 at 12:13:51PM -0500, kmx via RT wrote: Show quoted text
> Queue: Math-Pari > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52146 > >
> > - my $cmd = "cd $dir ; $patch -p1 < ../$p"; > > + my $cmd = ($^O eq 'MSWin32') ? "cd $dir & $patch -p1 --binary < > > ..\\$p" : "cd $dir ; $patch -p1 < ../$p"; > > > > This looks very strange to me, since $p contains slash... How comes?
> > You are right, backslashes are not necessary, you can use: > > my $cmd = ($^O eq 'MSWin32') ? "cd $dir & $patch -p1 --binary < ../$p" : > "cd $dir ; $patch -p1 < ../$p";
This is very surprising! I thought that cmd.exe treated / as "a zero-length argument separator"... Is it documented/mentioned somewhere that slashes may be used in redirection filenames? From when? Thanks, Ilya
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 12 Dec 2009 11:15:41 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Show quoted text
> Aha! Thanks for the suggestion. Could you manually add -p1 to line > 510 of utils/Math/PariBuild.pm? I suspect one needs also to add ./ to > file names inside utils/inc_h.diff ... >
It is necessary to make the following change: - system "$patch --binary < $p" + system "$patch -p0 --binary < $p" After that Math-Pari-2.01080603 installs fine on Win32. PLEASE, consider using standard prompt function for user interaction as the current version does not comply with best-practice. See http://www.perlfoundation.org/perl5/index.cgi?cpan_packaging (section "Use prompt() for build interaction."). -- kmx
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 12 Dec 2009 11:26:58 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Show quoted text
> This is very surprising! I thought that cmd.exe treated / as "a > zero-length argument separator"... > > Is it documented/mentioned somewhere that slashes may be used in > redirection filenames? From when?
Well I do not know since when but using "command < ../path/to/file.txt" works at least on my WinXP box. See a long discussion at: http://bytes.com/topic/python/answers/23123-when-did-windows-start-accepting-forward-slash-path-separator -- kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 12 Dec 2009 09:15:53 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Dec 12, 2009 at 05:16:24AM -0500, kmx via RT wrote: Show quoted text
> It is necessary to make the following change: > > - system "$patch --binary < $p" > + system "$patch -p0 --binary < $p" > > After that Math-Pari-2.01080603 installs fine on Win32.
Thanks! Show quoted text
> PLEASE, consider using standard prompt function for user interaction as > the current version does not comply with best-practice.
What happens which "does not comply"? Yours, Ilya
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Sat, 12 Dec 2009 09:44:04 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Sat, Dec 12, 2009 at 05:27:56AM -0500, kmx via RT wrote: Show quoted text
> Queue: Math-Pari > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=52146 > > >
> > This is very surprising! I thought that cmd.exe treated / as "a > > zero-length argument separator"... > > > > Is it documented/mentioned somewhere that slashes may be used in > > redirection filenames? From when?
> Well I do not know since when but using "command < ../path/to/file.txt" > works at least on my WinXP box. > > See a long discussion at: > http://bytes.com/topic/python/answers/23123-when-did-windows-start-accepting-forward-slash-path-separator
IIRC, there are exactly 2 posts which describe BOTH the behaviour and the version of the OS/shell... I would say the discussion is pretty useless... (And it concentrates on chdir - which is an internal command - not on redirection applied to an arbitrary program.) Thanks anyway, Ilya
Hi Ilya,

I am back again with MS Windows issues in Math-Pari.

I have dome more testing with the new gcc toolchain we (strawberry perl project) are about to use with upcoming perl 5.12. This new toolchain is based on gcc-4.4.3 compiler and C runtime libraries provided by mingw-w64 project (they deliver both 32-bit/64-bit runtimes).

It turned out that there are some additional issues that need to be handled in order to support MS Windows platform with the old gcc3 toolchain (by mingw.org project) as well as the new gcc4 toolchain (by mingw-w64.sf.net project).

IMPORTANT: I am trying to fix just issues concerning 32-bit MS Windows. With the enclosed patch I am able to compile your module also on 64-bit platform but the bunch of warnings indicates that libpari-2.1.7 does not have proper 64-bit support for MS Windows. After fixing Windows 32bit support we can open a new RT on Windows 64bit support.

So what needs to be patched:

1) missing patch option -p0 discussed above

2) I have added 32bit MS Windows detection in this way
... if ($Config{archname} eq 'MSWin32-x86-multi-thread' or $Config{cc} =~ /gcc/)

3) The patch for pari-2.1.7 was necessary - I have added patches/diff_2.1.7_mingw-w64
The fixed problems mostly concern colisions between pari macros and windows.h macros + an issue with using small as variable name (I have not investigated why but it seems like "small" is gcc4 keyword or macro included from some header). Anyway I have set this new patch to conditionally apply only on MSWin32.

4) I have fixed this issue in Pari.xs
Pari.xs: In function 'XS_Math__Pari_dumpStack':
Pari.xs:3798: warning: passing argument 2 of '(*Perl_IStdIO_ptr((struct PerlInterpreter *)Perl_get_context()))->pPuts' from incompatible pointer type
Pari.xs:3798: note: expected 'struct FILE *' but argument is of type 'char *'
Pari.xs:3798: warning: passing argument 3 of '(*Perl_IStdIO_ptr((struct PerlInterpreter *)Perl_get_context()))->pPuts' from incompatible pointer type
Pari.xs:3798: note: expected 'const char *' but argument is of type 'struct FILE *'

The changes I am proposing you can find in the enclosed files:
- Math-Pari-2.01080603.patch
- diff_2.1.7_mingw-w64

--
kmx
Subject: Math-Pari-2.01080603.patch
diff -ru Math-Pari-2.01080603.orig/Pari.xs Math-Pari-2.01080603_patched/Pari.xs --- Math-Pari-2.01080603.orig/Pari.xs 2009-12-11 03:18:24.000000000 +0100 +++ Math-Pari-2.01080603_patched/Pari.xs 2010-01-29 16:06:22.351979000 +0100 @@ -3795,7 +3795,7 @@ SvREFCNT_dec(tmp); } if(GIMME_V == G_VOID) { - fputs(SvPV_nolen(ret),stdout); + fputs(stdout,SvPV_nolen(ret)); SvREFCNT_dec(ret); XSRETURN(0); } else { Pouze v Math-Pari-2.01080603_patched/patches: diff_2.1.7_mingw-w64 diff -ru Math-Pari-2.01080603.orig/utils/Math/PariBuild.pm Math-Pari-2.01080603_patched/utils/Math/PariBuild.pm --- Math-Pari-2.01080603.orig/utils/Math/PariBuild.pm 2009-12-11 02:45:28.000000000 +0100 +++ Math-Pari-2.01080603_patched/utils/Math/PariBuild.pm 2010-01-29 15:54:08.843275700 +0100 @@ -481,6 +481,7 @@ 'patches/diff_2.1.6_no-common'], '2.1.7' => [ ($^O =~ /darwin/i ? 'patches/diff_2.1.6_no-common' : ()), + ($^O eq 'MSWin32' ? 'patches/diff_2.1.7_mingw-w64' : ()), 'patches/patch-pari-unnormalized-float', 'patches/diff_2.1.7_-O', 'patches/diff_2.1.7_div', @@ -507,7 +508,7 @@ return '/' unless $^O =~ /win32/i; my($patch, $p) = (shift, 'utils/inc_h.diff'); $p =~ s,/,\\,g; - system "$patch --binary < $p" + system "$patch -p0 --binary < $p" or warn("... Apparently, your patch takes flag --binary...\n"), return ('\\', '--binary'); return '\\'; @@ -887,6 +888,8 @@ or $os eq 'freebsd' or $os =~ /^cygwin/) { chomp($machine = `uname -m`); $machine ||= 'ix86'; + } elsif ($Config{archname} eq 'MSWin32-x86-multi-thread' or $Config{cc} =~ /gcc/) { + $machine = 'ix86'; } elsif (0 and $os =~ /win32/i and not $Config{gccversion}) { # Not needed with rename of kernel1.s to kernel1.c? $machine = 'port'; # Win32 compilers would not understand the assmebler anyway
Subject: diff_2.1.7_mingw-w64
Download diff_2.1.7_mingw-w64
application/octet-stream 13.5k

Message body not shown because it is not plain text.

CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Tue, 2 Feb 2010 14:50:26 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Tue, Feb 02, 2010 at 05:44:41AM -0500, kmx via RT wrote: Show quoted text
> 3) The patch for pari-2.1.7 was necessary - I have added > patches/diff_2.1.7_mingw-w64 > The fixed problems mostly concern colisions between pari macros and windows.h > macros + an issue with using small as variable name (I have not investigated > why but it seems like "small" is gcc4 keyword or macro included from some > header). Anyway I have set this new patch to conditionally apply only on > MSWin32.
Should not this `small' issue be reported to mingw team? [use options -E -dD of compiler to find where things are introduced] Show quoted text
> 4) I have fixed this issue in Pari.xs > Pari.xs: In function 'XS_Math__Pari_dumpStack': > Pari.xs:3798: warning: passing argument 2 of '(*Perl_IStdIO_ptr((struct > PerlInterpreter *)Perl_get_context()))->pPuts' from incompatible pointer type > Pari.xs:3798: note: expected 'struct FILE *' but argument is of type 'char *' > Pari.xs:3798: warning: passing argument 3 of '(*Perl_IStdIO_ptr((struct > PerlInterpreter *)Perl_get_context()))->pPuts' from incompatible pointer type > Pari.xs:3798: note: expected 'const char *' but argument is of type 'struct > FILE *'
Can it be corrected in Perl's headers as well? I reported it (maybe even several times) with no effect... http://groups.google.com/group/comp.lang.perl.modules/browse_thread/thread/d77eaeb571959545/93159c24f5633757#93159c24f5633757 Ilya
Further analysis:

Show quoted text
> Should not this `small' issue be reported to mingw team?
>
> [use options -E -dD of compiler to find where things are introduced]
It turned out that small definition that causes the collision comes from <windows.h>

The solution I have tested on small test case is to define
#define WIN32_LEAN_AND_MEAN
before including <windows.h>

However the problem may occur when somebody includes <windows.h> before <pari.h> without defining WIN32_LEAN_AND_MEAN.

The other problem also occur when somebody includes <pari.h> after <windows.h> as pari.h defines some macros like lpsi which breaks <windows.h> (this was the reason why I have included <windows.h> at the beginning of <pari.h> at the point when these conflicting macros were not defined yet).

So not easy to fix.

Show quoted text
> Can it be corrected in Perl's headers as well? I reported it (maybe
> even several times) with no effect...
Hmmm, you are right. I have just mechanically satisfied the warning. Have you asked at perl5portes mailing list?

--
kmx

CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Wed, 3 Feb 2010 00:18:25 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Wed, Feb 03, 2010 at 02:46:01AM -0500, kmx via RT wrote: Show quoted text
> > Can it be corrected in Perl's headers as well? I reported it (maybe > > even several times) with no effect...
Show quoted text
> Hmmm, you are right. I have just mechanically satisfied the warning. Have you > asked at perl5portes mailing list?
I think I might have (5 or 10 years ago...); can't be sure now... Yours, Ilya
Show quoted text
> > Have you asked at perl5portes mailing list?
>
> I think I might have (5 or 10 years ago...); can't be sure now...

So here is my try:
http://rt.perl.org/rt3/Ticket/Display.html?id=72704

--
kmx

OK. I just got pointed to this (kmx has been acting on my behalf, as Math::Pari is important enough to Strawberry's functionality [it's needed for what I call the "crypto toolchain", IIRC, as well as a few other things]) that not having it be able to build is a blocker to us, and he's been the one working with the mingw64/gcc4 toolchain getting things shaken out so that when perl 5.12.0 happens, we can release both 32 and 64-bit versions of Strawberry Perl. 1. Because you do not use prompt() (at least, that's what I see in the earlier messages - that may have changed), we need to precompile a .par with a half-built version, and then run the full build again, whenever Strawberry wants to support a new major version of Perl, a different compiler, or include a new version of Math::Pari. (We can't have interaction when we do our builds, but we CAN pass parameters to the Makefile.PL.) This is tedious, but it's a "one-time" thing. The problem with that is that it is easily forgotten about. If you use prompt(), we can set the appropriate environment variable and Makefile.PL options and go our merry way, and we don't have to remember to build a new .par, we could just use our normal build process and Math::Pari will automatically be up-to-date as of the build date/time of the mirror we use to build Strawberry. 2. As for patch.exe needing --binary - my assumption is that anything that is not CRLF-ended is considered "binary", and we're stuck with it. :( 3. #define WIN32_LEAN_AND_MEAN - I remember that from my bouts of C and C++ programming, and it's so highly recommended by Microsoft (it's defined by default when you create a VC++ application or dll) as to be almost a default, for exactly the reasons kmx has illustrated (conflicting definitions without it). If there are any particular problems with the patches kmx has submitted, and you have suggestions about different implementations, please let us know and we'll create new ones that we can use. I'm just starting to look into this myself - I've just starred this so it's on my watch list. Will keep in touch.
I have one correction to the earlier patches: + } elsif ($Config{archname} eq 'MSWin32-x86-multi-thread' or $Config{cc} =~ /gcc/) { + $machine = 'ix86'; That "or", I think, needs to be an "and". (GCC does not only run on x86 machines.)
Also, kmx: will just applying #define WIN32_LEAN_AND_MEAN in the appropriate place make the patches for pari-2.1.7 much less intrusive? I think that's what I, at least, (I can't speak for Ilya) would prefer to see, if that's possible.
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Tue, 2 Mar 2010 11:41:08 -0800
To: Curtis Jewell via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Tue, Mar 02, 2010 at 02:17:52PM -0500, Curtis Jewell via RT wrote: Show quoted text
> Queue: Math-Pari > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52146 > > > OK. I just got pointed to this (kmx has been acting on my behalf, as > Math::Pari is important enough to Strawberry's functionality [it's > needed for what I call the "crypto toolchain", IIRC, as well as a few > other things]) that not having it be able to build is a blocker to us, > and he's been the one working with the mingw64/gcc4 toolchain getting > things shaken out so that when perl 5.12.0 happens, we can release both > 32 and 64-bit versions of Strawberry Perl. > > 1. Because you do not use prompt() (at least, that's what I see in the > earlier messages - that may have changed), we need to precompile a .par > with a half-built version, and then run the full build again, whenever > Strawberry wants to support a new major version of Perl, a different > compiler, or include a new version of Math::Pari. (We can't have > interaction when we do our builds, but we CAN pass parameters to the > Makefile.PL.) > > This is tedious, but it's a "one-time" thing. The problem with that is > that it is easily forgotten about. > > If you use prompt(), we can set the appropriate environment variable and > Makefile.PL options and go our merry way, and we don't have to remember > to build a new .par, we could just use our normal build process and > Math::Pari will automatically be up-to-date as of the build date/time of > the mirror we use to build Strawberry.
Irrelevant nowadays, I believe. The rest is in my queue. Ilya P.S. I got a 64-bit assember enabler patch for x86 (for 2.3.*). Attached. Testing and feedback is appreciated.
Subject: Re: Math::Pari: Problem with Assembler detection
Date: Sat, 27 Feb 2010 10:03:12 +0100
To: Ilya Zakharevich <ilya [...] math.berkeley.edu>
From: Alexander Haeckel <alexanderhaeckel [...] lavabit.com>
Here comes the patch:
--- old/Math-Pari-2.01080603/utils/Math/PariBuild.pm 2009-12-11 02:45:28.000000000 +0100 +++ Math-Pari-2.01080603/utils/Math/PariBuild.pm 2010-02-27 09:38:41.000000000 +0100 @@ -1029,6 +1029,7 @@ sub inline_headers_arr { # These fil # ppc is not done yet (2.0.15) ($pari_version > 2002007 ? (ppc => ['ppc/asm0.h', 'none/divll.h'], + x86_64 => ['x86_64/asm0.h','none/level1.h'], ia64 => ['ia64/asm0.h','ia64/asm1.h']) : ()), sparcv7 => ['none/asm0.h','none/level1.h'], @@ -1125,7 +1126,7 @@ sub choose_and_report_assembler { ? 'hppa' : 'none'), ); my $asmarch = $asmarch{$machine} || $machine; # Temporary only - my %skip64 = (alpha => 1, none => 1, ia64 => 1); + my %skip64 = (alpha => 1, none => 1, ia64 => 1, x86_64 => 1,); if (not $skip64{$asmarch} and ($Config{longsize} || 0) == 8) { $asmarch .= '_64'; @@ -1601,7 +1602,7 @@ sub code_C_translator { my @t = ExtUtils::Constant::constant_types(); # macro defs my @tt = ExtUtils::Constant::C_constant( - 'Math::Pari::func_type', + 'Math::Pari::func_type', 'func_ord_by_type', undef, undef, undef, undef, map {{name => $_, value => $codes{$_}, macro => 1}} keys %codes);
According to pari-2.3.5/CHANGES-2.2 the patch should work beginning with version 2.2.8, but the earliest I could find on http://pari.math.u-bordeaux.fr/pub/pari/unix/ was 2.3.0. So please take this as a warning that something could break. But I don't expect this to happen. Thank you very much for this excellent module, Alexander Ilya Zakharevich <ilya@math.berkeley.edu> writes: Show quoted text
> For best result, could you also send me results of > > diff -pu old_file new_file > > for these edits?
CC: kmx [...] cpan.org
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Tue, 02 Mar 2010 23:27:46 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Hi, Show quoted text
> If you use prompt(), we can set the appropriate environment variable and > Makefile.PL options and go our merry way, and we don't have to remember > to build a new .par, we could just use our normal build process and > Math::Pari will automatically be up-to-date as of the build date/time of > the mirror we use to build Strawberry. >
AFAIK Math::Pari handles env variables AUTOMATED_TESTING + PERL_MM_USE_DEFAULT itself which I also do not consider a good idea (as you can see from my previous posts :) but it works. Show quoted text
> 2. As for patch.exe needing --binary - my assumption is that anything > that is not CRLF-ended is considered "binary", and we're stuck with it. :( >
For this we have used in Alien::SDL the following platform independent trick: $patch_file = ......; system("$^X -pe '' -- $patch_file | patch -N -p1 -u"); Just an idea, of course you might not like it. Show quoted text
> 3. #define WIN32_LEAN_AND_MEAN ...
I have not got further with this. -- kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Tue, 2 Mar 2010 19:00:05 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Tue, Mar 02, 2010 at 05:28:48PM -0500, kmx via RT wrote: Show quoted text
> $patch_file = ......; > system("$^X -pe '' -- $patch_file | patch -N -p1 -u");
This looks very fragile and baroque. Why not system qq($^X -pe0 -- "$patch_file" | patch -p1) AFAIK, -u is not portable; -N is too error-forgiving... Yours, Ilya
RT-Send-CC: csjewell [...] cpan.org
Hi Ilya,

Show quoted text
> > system("$^X -pe '' -- $patch_file | patch -N -p1 -u");
>
> This looks very fragile and baroque. Why not
>
> system qq($^X -pe0 -- "$patch_file" | patch -p1)
>
> AFAIK, -u is not portable; -N is too error-forgiving...

To be honest I am not the author of that idea, but you are right, your suggestion seems better.

Anyway WHAT IS IMPORTANT - I have finally prepared the smallest possible patch for Math-Pari-2.01080603 to work with both:
1/ 32bit gcc3 toolchain by mingw.org
2/ 32bit gcc4 toolchain by mingw-w64.sf.net

See attached Math-Pari-2.01080603_kmx.patch + releasing it on CPAN.

Please, please consider accepting this patch

The patch is soo simple & clear & nice that I cannot imagine a better one :)

--
kmx

Subject: Math-Pari-2.01080603_kmx.patch
diff -ru Math-Pari-2.01080603\Pari.xs Math-Pari-2.01080603.patched\Pari.xs --- Math-Pari-2.01080603\Pari.xs Fri Dec 11 03:18:24 2009 +++ Math-Pari-2.01080603.patched\Pari.xs Wed Mar 03 09:21:26 2010 @@ -1,3 +1,9 @@ +/* we need to include windows.h quite early to avoid some macro name collisions */ +#ifdef _WIN32 +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + # include <pari.h> # include <graph/rect.h> # include <language/anal.h> diff -ru Math-Pari-2.01080603\patches\diff_2.1.7_mingw-w64 Math-Pari-2.01080603.patched\patches\diff_2.1.7_mingw-w64 --- Math-Pari-2.01080603\patches\diff_2.1.7_mingw-w64 Wed Mar 03 09:35:45 2010 +++ Math-Pari-2.01080603.patched\patches\diff_2.1.7_mingw-w64 Wed Mar 03 09:26:18 2010 @@ -0,0 +1,17 @@ +diff -ru pari-2.1.7.orig\src\gp\highlvl.c pari-2.1.7\src\gp\highlvl.c +--- pari-2.1.7.orig\src\gp\highlvl.c Tue Apr 23 17:29:37 2002 ++++ pari-2.1.7\src\gp\highlvl.c Wed Mar 03 09:21:11 2010 +@@ -18,6 +18,13 @@ + /* SOME GP FUNCTION THAT MAY BE USEFUL OUTSIDE OF IT */ + /* */ + /*******************************************************************/ ++ ++/* we need to include windows.h quite early to avoid some macro name collisions */ ++#ifdef _WIN32 ++# define WIN32_LEAN_AND_MEAN ++# include <windows.h> ++#endif ++ + #include "pari.h" + #ifdef macintosh + # include "rect.h" diff -ru Math-Pari-2.01080603\utils\Math\PariBuild.pm Math-Pari-2.01080603.patched\utils\Math\PariBuild.pm --- Math-Pari-2.01080603\utils\Math\PariBuild.pm Fri Dec 11 02:45:28 2009 +++ Math-Pari-2.01080603.patched\utils\Math\PariBuild.pm Tue Mar 02 23:02:12 2010 @@ -481,6 +481,7 @@ 'patches/diff_2.1.6_no-common'], '2.1.7' => [ ($^O =~ /darwin/i ? 'patches/diff_2.1.6_no-common' : ()), + ($^O eq 'MSWin32' ? 'patches/diff_2.1.7_mingw-w64' : ()), 'patches/patch-pari-unnormalized-float', 'patches/diff_2.1.7_-O', 'patches/diff_2.1.7_div', @@ -507,7 +508,7 @@ return '/' unless $^O =~ /win32/i; my($patch, $p) = (shift, 'utils/inc_h.diff'); $p =~ s,/,\\,g; - system "$patch --binary < $p" + system "$patch -p0 --binary < $p" or warn("... Apparently, your patch takes flag --binary...\n"), return ('\\', '--binary'); return '\\'; @@ -887,6 +888,8 @@ or $os eq 'freebsd' or $os =~ /^cygwin/) { chomp($machine = `uname -m`); $machine ||= 'ix86'; + } elsif (($Config{archname} eq 'MSWin32-x86-multi-thread') && ($Config{cc} =~ /gcc/)) { + $machine = 'ix86'; } elsif (0 and $os =~ /win32/i and not $Config{gccversion}) { # Not needed with rename of kernel1.s to kernel1.c? $machine = 'port'; # Win32 compilers would not understand the assmebler anyway
The same idea from previous post applied to Math-Pari-2.0304_01080603

Works fine with:
1/ 32bit ggc3 toolchain from mingw.org
2/ 32bit gcc4 toolchain from mingw-w64.sf.net

Unfortunately bad news as for 64bit MS Windows. When tried to compile on this platform (64bit gcc4 toolchain from mingw-w64.sf.net) i got more that 2000 (two thousand) warnings like:
- warning: cast to pointer from integer of different size
- warning: cast from pointer to integer of differ

The point is that on 64bit MS Windows there is:
- size of int = 4 bytes (!!!)
- size of *void = 8 bytes

So casting between integer and pointer is not generally safe.

In the end math::Pari compiles however nearly all tests end with perl.exe crash.

--
kmx
Subject: Math-Pari-2.0304_01080603_kmx.patch
diff -ru Math-Pari-2.0304_01080603.orig\Pari.xs Math-Pari-2.0304_01080603.new\Pari.xs --- Math-Pari-2.0304_01080603.orig\Pari.xs Fri Dec 11 03:18:24 2009 +++ Math-Pari-2.0304_01080603.new\Pari.xs Wed Mar 03 12:29:27 2010 @@ -1,3 +1,9 @@ +/* we need to include windows.h quite early to avoid some macro name collisions */ +#ifdef _WIN32 +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + # include <pari.h> # include <graph/rect.h> # include <language/anal.h> diff -ru Math-Pari-2.0304_01080603.orig\patches\diff_2.1.7_mingw-w64 Math-Pari-2.0304_01080603.new\patches\diff_2.1.7_mingw-w64 --- Math-Pari-2.0304_01080603.orig\patches\diff_2.1.7_mingw-w64 Wed Mar 03 12:39:46 2010 +++ Math-Pari-2.0304_01080603.new\patches\diff_2.1.7_mingw-w64 Wed Mar 03 09:26:18 2010 @@ -0,0 +1,17 @@ +diff -ru pari-2.1.7.orig\src\gp\highlvl.c pari-2.1.7\src\gp\highlvl.c +--- pari-2.1.7.orig\src\gp\highlvl.c Tue Apr 23 17:29:37 2002 ++++ pari-2.1.7\src\gp\highlvl.c Wed Mar 03 09:21:11 2010 +@@ -18,6 +18,13 @@ + /* SOME GP FUNCTION THAT MAY BE USEFUL OUTSIDE OF IT */ + /* */ + /*******************************************************************/ ++ ++/* we need to include windows.h quite early to avoid some macro name collisions */ ++#ifdef _WIN32 ++# define WIN32_LEAN_AND_MEAN ++# include <windows.h> ++#endif ++ + #include "pari.h" + #ifdef macintosh + # include "rect.h" diff -ru Math-Pari-2.0304_01080603.orig\patches\diff_2.3.5_mingw-w64 Math-Pari-2.0304_01080603.new\patches\diff_2.3.5_mingw-w64 --- Math-Pari-2.0304_01080603.orig\patches\diff_2.3.5_mingw-w64 Wed Mar 03 12:39:41 2010 +++ Math-Pari-2.0304_01080603.new\patches\diff_2.3.5_mingw-w64 Wed Mar 03 12:31:39 2010 @@ -0,0 +1,17 @@ +diff -ru pari-2.3.5.orig\src\gp\highlvl.c pari-2.3.5\src\gp\highlvl.c +--- pari-2.3.5.orig\src\gp\highlvl.c Thu Feb 04 11:55:42 2010 ++++ pari-2.3.5\src\gp\highlvl.c Wed Mar 03 12:28:18 2010 +@@ -18,6 +18,13 @@ + /* SOME GP FUNCTION THAT MAY BE USEFUL OUTSIDE OF IT */ + /* */ + /*******************************************************************/ ++ ++/* we need to include windows.h quite early to avoid some macro name collisions */ ++#ifdef _WIN32 ++# define WIN32_LEAN_AND_MEAN ++# include <windows.h> ++#endif ++ + #include "pari.h" + #include "paripriv.h" + #include "../graph/rect.h" diff -ru Math-Pari-2.0304_01080603.orig\utils\Math\PariBuild.pm Math-Pari-2.0304_01080603.new\utils\Math\PariBuild.pm --- Math-Pari-2.0304_01080603.orig\utils\Math\PariBuild.pm Fri Dec 11 02:45:28 2009 +++ Math-Pari-2.0304_01080603.new\utils\Math\PariBuild.pm Wed Mar 03 12:34:57 2010 @@ -481,11 +481,14 @@ 'patches/diff_2.1.6_no-common'], '2.1.7' => [ ($^O =~ /darwin/i ? 'patches/diff_2.1.6_no-common' : ()), + ($^O eq 'MSWin32' ? 'patches/diff_2.1.7_mingw-w64' : ()), 'patches/patch-pari-unnormalized-float', 'patches/diff_2.1.7_-O', 'patches/diff_2.1.7_div', 'patches/diff_2.1.6_align_power_of_2', 'patches/diff_2.1.7_restart'], + '2.3.5' => [ + ($^O eq 'MSWin32' ? 'patches/diff_2.3.5_mingw-w64' : ())], ); print "Looking for patches for $v...\n"; my @p = $patches{$v} ? @{$patches{$v}} : (); @@ -507,7 +510,7 @@ return '/' unless $^O =~ /win32/i; my($patch, $p) = (shift, 'utils/inc_h.diff'); $p =~ s,/,\\,g; - system "$patch --binary < $p" + system "$patch -p0 --binary < $p" or warn("... Apparently, your patch takes flag --binary...\n"), return ('\\', '--binary'); return '\\'; @@ -887,6 +890,8 @@ or $os eq 'freebsd' or $os =~ /^cygwin/) { chomp($machine = `uname -m`); $machine ||= 'ix86'; + } elsif (($Config{archname} eq 'MSWin32-x86-multi-thread') && ($Config{cc} =~ /gcc/)) { + $machine = 'ix86'; } elsif (0 and $os =~ /win32/i and not $Config{gccversion}) { # Not needed with rename of kernel1.s to kernel1.c? $machine = 'port'; # Win32 compilers would not understand the assmebler anyway
Show quoted text
> Unfortunately bad news as for 64bit MS Windows. When tried to compile > on this > platform (64bit gcc4 toolchain from mingw-w64.sf.net) i got more that > 2000 (two > thousand) warnings like: > - warning: cast to pointer from integer of different size > - warning: cast from pointer to integer of differ
A little incestuous, maybe, but is there a __int64 type (or something of the like, I'm not looking at a C reference as I'm typing, and its 0600 here) that we could #ifdef 'int' to in 64-bit builds? [on side note: 64-bit may have to STAY in beta through April 2009 release cycle.]
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Wed, 3 Mar 2010 14:13:01 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Wed, Mar 03, 2010 at 03:46:38AM -0500, kmx via RT wrote: Show quoted text
> Anyway WHAT IS IMPORTANT - I have finally prepared the smallest possible patch > for Math-Pari-2.01080603 to work with both: > 1/ 32bit gcc3 toolchain by mingw.org > 2/ 32bit gcc4 toolchain by mingw-w64.sf.net > > See attached Math-Pari-2.01080603_kmx.patch + releasing it on CPAN.
A lot of thanks. Included (slightly modded) in Math-Pari-2.01080604.tar.gz. Please test. Yours, Ilya
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Wed, 3 Mar 2010 15:30:34 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Thu, Feb 11, 2010 at 02:56:55PM -0500, kmx via RT wrote: Show quoted text
> Queue: Math-Pari > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52146 > >
> > > Have you asked at perl5portes mailing list?
> > > > I think I might have (5 or 10 years ago...); can't be sure now...
> > So here is my try: > http://rt.perl.org/rt3/Ticket/Display.html?id=72704
I see (maybe you do too ;-[ ). My experience with perlbug is that the bugs are eventually closed with (practically) no human intervention. IIRC, I reported on p5p... Yours, Ilya
RT-Send-CC: csjewell [...] cpan.org
Show quoted text
> A lot of thanks. Included (slightly modded) in
> Math-Pari-2.01080604.tar.gz.
>
> Please test.

Math-Pari-2.01080604 builds fine + all test pass on both 32bit gcc toolchains.

However the latest dev version Math-Pari-2.0305_01080604a fails to build. See my patch Math-Pari-2.0304_01080603_kmx.patch enclosed ti this RT - another diff_2.3.5_mingw-w64 needs to be added).

Anyway many thanks for making the stable Math::Pari version work well on Win32+gcc(3|4) platform.

--
kmx
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Thu, 4 Mar 2010 12:35:03 -0800
To: kmx via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Thu, Mar 04, 2010 at 03:17:29AM -0500, kmx via RT wrote: Show quoted text
> Math-Pari-2.01080604 builds fine + all test pass on both 32bit gcc toolchains. > > However the latest dev version Math-Pari-2.0305_01080604a fails to build. See > my patch Math-Pari-2.0304_01080603_kmx.patch enclosed ti this RT - another > diff_2.3.5_mingw-w64 needs to be added).
A lot of thanks for your testing and improvements. However, could you please send the patch via email? Yours, Ilya
Subject: Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Fri, 05 Mar 2010 06:10:48 +0100
To: bug-Math-Pari [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Dne 4.3.2010 21:35, Ilya Zakharevich via RT napsal(a): Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=52146 > > > On Thu, Mar 04, 2010 at 03:17:29AM -0500, kmx via RT wrote: >
>> Math-Pari-2.01080604 builds fine + all test pass on both 32bit gcc toolchains. >> >> However the latest dev version Math-Pari-2.0305_01080604a fails to build. See >> my patch Math-Pari-2.0304_01080603_kmx.patch enclosed ti this RT - another >> diff_2.3.5_mingw-w64 needs to be added). >>
> A lot of thanks for your testing and improvements. However, could you > please send the patch via email? >
Hi Ilya, on top of Math-Pari-2.0305_01080604 you need to: 1/ patch utils\Math\PariBuild.pm - see attached PariBuild.pm.patch 2/ add the attached diff_2.3.5_mingw-w64 to 'patches' subdir -- kmx

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

On Fri Mar 05 00:13:45 2010, kmx@volny.cz wrote: Show quoted text
> > Dne 4.3.2010 21:35, Ilya Zakharevich via RT napsal(a):
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=52146 > > > > > On Thu, Mar 04, 2010 at 03:17:29AM -0500, kmx via RT wrote: > >
> >> Math-Pari-2.01080604 builds fine + all test pass on both 32bit gcc > >> toolchains. > >> > >> However the latest dev version Math-Pari-2.0305_01080604a fails to > >> build. See > >> my patch Math-Pari-2.0304_01080603_kmx.patch enclosed ti this RT - > >> another > >> diff_2.3.5_mingw-w64 needs to be added). > >>
> > A lot of thanks for your testing and improvements. However, could > > you > > please send the patch via email? > >
> > Hi Ilya, > > on top of Math-Pari-2.0305_01080604 you need to: > > 1/ patch utils\Math\PariBuild.pm - see attached PariBuild.pm.patch > > 2/ add the attached diff_2.3.5_mingw-w64 to 'patches' subdir > > -- > kmx
In email discussion with Ilya and browsing the module code, it looks like these patches were all applied long ago. There is a more fundamental problem with the pari library code involving 64-bit compiler differences with integer / pointer sizes and indiscriminate type casting. In newer versions of the pari library (see URLref: http://megrez.math.u-bordeaux.fr), they seem to be addressing some 64-bit issues (at least, there's some 64-bit specific code). But, as it's autoconf based, it's complicated to get the library to build under Windows/gcc-mingw. And I've been unable to accomplish a build. Once a successful build/test of the original pari library code is accomplished within Windows/gcc-mingw (64-bit), patches to this module might succeed. But I doubt it'll ever happen unless that is done first.
CC: "Ilya Zakharevich" <ilya [...] math.berkeley.edu>
Subject: Fw: Building Math::Pari on Strawberry Perl on 64bit MS Windows ( rt.cpan.org #52146) Fw: 64bit MS Windows Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Thu, 17 Apr 2014 18:17:58 +0300
To: "\"Ilya Zakharevich via RT\"" <bug-Math-Pari [...] rt.cpan.org>
From: "Victor Miasnikov" <vvm [...] tut.by>

Message body is not shown because it is too large.

Message body is not shown because it is too large.

Subject: Fw: 64bit MS Windows Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Thu, 17 Apr 2014 18:31:34 +0300
To: "\"Ilya Zakharevich via RT\"" <bug-Math-Pari [...] rt.cpan.org>
From: "Victor Miasnikov" <vvm [...] tut.by>
Hi! == Show quoted text
> Math::Pari needs heavy patching - namely the underlaying pari library is > absolutely not ready for MSWin/x64 where sizeof(int) != sizeof(void*)
But sizeof( long long) = sizeof(void*) == Problem: == The point is that on 64bit MS Windows there is: - size of int = 4 bytes (!!!) - size of *void = 8 bytes == May be solution: == . . . +#define PARITEMPL_O_NG(x) (x##LL) +#define PARITEMPUL_O_NG(x) (x##ULL) +typedef long long paritemplong_t; + +typedef long long mp_l_o_ng; +typedef unsigned long long mp_ul_o_ng; . . . == http://pari.math.u-bordeaux.fr/archives/pari-dev-0907/msg00003.html =} === From: Jason Moxham ... I've got Pari-svn running on Windows with/without GMP/MPIR in 64bit mode. This is with MSVC , and when MinGW/MSYS goes 64bit it will work with that :) The main problem with Windows64 is that it uses a LLP data model rather than the usual LP data model , this means that long's are 32 bit. I'm doing this for the Sage project but it would be nice if the changes could be incorporated back into Pari , so I propose this. Introduce a new type and macro ( with signed and unsigned versions) typedef long paritemplong_t; #define PARITEMPLONG(x) (x##L) replace all occurances of long with paritemplong_t and numberL with PARITEMPLONG(number) The above is all just simple text replacement and although it means changes to every file it will have no "real" changes. Then for WIN64 only we change the definition typedef long long paritemplong_t; #define PARITEMPLONG(x) (x##LL) ... === + == . . . On Mon, Nov 04, 2002 at 08:07:31PM +0100, Bill Allombert wrote: Show quoted text
> On Fri, Nov 01, 2002 at 12:13:16AM -0800, Ilya Zakharevich wrote:
> > On which architectures can PARI run with sizeof(long) > sizeof(long*)? > > I tested, and it does not work on x86.
> > None, as far as I know. > None of the 11 architectures I have access to exhibit this behaviour.
This patch kinda-allows compiling with GEN = long long*. The result of make bench is . . . == === ... Before applying the patch, a massive replace should be made, e.g., by running (pfind is available from my directory 'scripts' on CPAN): pfind src '/\.[ch]$/' '=~ s/\b(unsigned\s+|u)long\b/PARI_uword/g' pfind src '/\.[ch]$/' '=~ s/\blong\b/PARI_word/g' pfind src '/\.[ch]$/' '=~ s/\b(\d+|0[0-7]+|0x[\da-fA-F])(U?)L\b/as_${2}WORD($1)/g' pfind src '/\.[ch]$/' '=~ s/(%[.0-9]*)l([ux])\"/$1\"UW${2}f/g' pfind src '/\.[ch]$/' '=~ s/(%[.0-9]*)l([d])\"/$1\"IW${2}f/g' pfind src '/\.[ch]$/' '=~ s/(%[.0-9]*)l([ux])/$1\"UW${2}f\"/g' pfind src '/\.[ch]$/' '=~ s/(%[.0-9]*)l([d])/$1\"IW${2}f\"/g' ... === . . . == Best regards, Victor Miasnikov Blog: http://vvm.blog.tut.by/
Subject: Re: Fw: 64bit MS Windows Re: [rt.cpan.org #52146] [PATCH] Building Math::Pari on Win32/strawberry perl
Date: Fri, 25 Apr 2014 01:20:15 -0700
To: Victor Miasnikov via RT <bug-Math-Pari [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Thu, Apr 17, 2014 at 11:31:52AM -0400, Victor Miasnikov via RT wrote: Show quoted text
> Queue: Math-Pari > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52146 > > > Hi! > > ==
> > Math::Pari needs heavy patching - namely the underlaying pari library is > > absolutely not ready for MSWin/x64 where sizeof(int) != sizeof(void*)
> > > But > sizeof( long long) = sizeof(void*) > == > > > Problem: > == > The point is that on 64bit MS Windows there is: > - size of int = 4 bytes (!!!) > - size of *void = 8 bytes > == > > > May be solution:
Sorry, Victor, It looks like in the foreseeable future I would not be able to spend much time on PARI. Thanks, Ilya