Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

[OT] Building Math::Pari on M$ Windows

by syphilis (Bishop)
on Apr 03, 2007 at 12:34 UTC ( #608046=perlquestion: print w/replies, xml ) Need Help??

syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
This post relates to my attempts to build Math-Pari-2.010709 (against pari-2.1.7) on Windows.

Using VC7 (with a VC7-built perl) on Windows 2000 there's no problem. (I fully expect that the same holds wrt VC6.) And using MinGW's gcc compiler on Vista 64 (with a 32-bit build of perl) there's still no problem.

The fun begins when I try to build it on my Vista 64 box with ActiveState's 64-bit build of perl-5.8.8, using the very same Platform SDK that was used to build that perl. Running 'nmake' culminates in:
C:\_64\Platform_SDK\Include\WinUser.h(9659) : error C2146: syntax erro +r : missing ')' before identifier 'gpsi' C:\_64\Platform_SDK\Include\WinUser.h(9659) : error C2061: syntax erro +r : identifier 'gpsi' C:\_64\Platform_SDK\Include\WinUser.h(9659) : error C2059: syntax erro +r : ';' C:\_64\Platform_SDK\Include\WinUser.h(9659) : error C2059: syntax erro +r : ',' C:\_64\Platform_SDK\Include\WinUser.h(9660) : error C2059: syntax erro +r : ')' C:\_64\Platform_SDK\Include\WinUser.h(9668) : error C2146: syntax erro +r : missing ')' before identifier 'gpsi' C:\_64\Platform_SDK\Include\WinUser.h(9668) : error C2061: syntax erro +r : identifier 'gpsi' C:\_64\Platform_SDK\Include\WinUser.h(9668) : error C2059: syntax erro +r : ';' C:\_64\Platform_SDK\Include\WinUser.h(9668) : error C2059: syntax erro +r : ')' ../pari-2.1.7\src\gp\highlvl.c(201) : warning C4311: 'type cast' : poi +nter truncation from 'GEN' to 'long' ../pari-2.1.7\src\gp\highlvl.c(204) : warning C4311: 'type cast' : poi +nter truncation from 'GEN' to 'long' ../pari-2.1.7\src\gp\highlvl.c(218) : warning C4311: 'type cast' : poi +nter truncation from 'GEN' to 'long' NMAKE : fatal error U1077: 'cl' : return code '0x2' Stop. NMAKE : fatal error U1077: 'cd' : return code '0x2' Stop.
The obvious thing to do is to then take a look at the offending code - even though one knows that there's not going to be any syntax errors in Platform SDK's WinUser.h. Anyway, when I run my little app that retrieves lines from a file I get:
Enter the line number 9659 Enter (full path to) file C:\_64\Platform_SDK\Include\WinUser.h 9655: WINAPI 9656: SetScrollInfo( 9657: __in HWND hwnd, 9658: __in int nBar, 9659: __in LPCSCROLLINFO lpsi, 9660: __in BOOL redraw); 9661: 9662: WINUSERAPI 9663: BOOL 9664: WINAPI 9665: GetScrollInfo( 9666: __in HWND hwnd, 9667: __in int nBar, 9668: __inout LPSCROLLINFO lpsi); 9669:
It puzzles me that there's not a 'gpsi' to be seen. (Is it possible that computers can suffer hallucinations from passive smoking ??)

I get exactly the same error if I use VC8 instead of Platform SDK, but since my VC8 is using the exact same header files, I guess it's not very surprising.

Ummm ... any advice on how to proceed ? I know it's not actually a perl problem - which is the reason that I marked it "OT".

Cheers,
Rob

Replies are listed 'Best First'.
Re: [OT] Building Math::Pari on M$ Windows
by almut (Canon) on Apr 03, 2007 at 13:44 UTC

    Hi Rob, you probably want to look at the preprocessed sources. Option /E dumps the output of the C preprocesser to stdout (i.e. with macros expanded, etc.), which might give you some clue as to what's going wrong...

    Just rerun the failing cl command with option /E added (use mouse to cut-n-paste a lengthy command line), and redirect stdout to a file for further inspection.  Good luck.

Re: [OT] Building Math::Pari on M$ Windows
by cdarke (Prior) on Apr 03, 2007 at 14:11 UTC
    I have had problems like this in the past (not specifically this one) where path names have had embedded spaces. Yes, use /E and check the header file included immediately before WinUser.h.
      Thanks almut, cdarke for the /E tip. It revealed that there's a function called 'gpsi' in the pari source, and I guess that was the root of the problem the compiler was having with the 'gpsi' identifier. I couldn't find out (didn't look too hard) what was changing the name of the identifier from 'lpsi' to 'gpsi' - in the end I just changed the 2 occurrences of 'lpsi' in WinUser.h to 'lxpsi' and that got me passed that hurdle.

      Next problem was:
      kernel1.c(223) : error C4235: nonstandard extension used : '__asm' key +word not supported on this architecture
      Is that telling me that inlining of assembly code is not supported on this architecture ? Or does it just mean that one needs to use a different keyword and/or technique to inline assembly code ?

      Finally, I tried a straight C build (no asm). That compiled ok, but resulted in a number of segfaults and test failures during the running of the test suite.

      I think I'll just settle for the 32-bit build - ftm, anyway.

      Cheers,
      Rob
      Update:"ftm" eq "for the moment". (I think there are some who might have thought it meant something else :-)
        Is that telling me that inlining of assembly code is not supported on this architecture ?

        Yes, probably. __asm{} was previously, only supported on x86. It would appear to indicate that they haven't yet, or maybe, are not intending to, ungrade the inline assembler to support iapx-64?

        This post on the MS forums might suggest a way around this, via the use of another non-standard extension __emit{}. But then you'd have to translate the opcode to hex yourself, which seems more than a little retro. Shades of Spectrum Duck Shoot :)


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://608046]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2021-06-24 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (130 votes). Check out past polls.

    Notices?