Building Python 2.2.1 for HP Tru64 UNIX V4.0F

Holden Caulfield phoebe_1 at att.net
Wed Oct 9 16:25:02 EDT 2002


"change" <changeme at changeme> wrote in message news:<ao18ke$1tn11 at kcweb01.netnews.att.com>...
> Hi,
> 
> I'm trying to build Python 2.2.1 for HP (COMPAQ) Tru64 UNIX V4.0F with the
> debug option.
> 
> The build fails in Python/marshal.c:
> 
> cc -c -O -Olimit 1500 -I. -I./Include -DHAVE_CONFIG_H  -o Python/marshal.o
> Python/marshal.c
> cc: Error: Python/marshal.c, line 64: Invalid expression. (badexpr)
>                 *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char);
> ----------------------------^
> cc: Error: Python/marshal.c, line 64: Invalid statement. (badstmt)
>                 *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char);
> ----------------------------^
> *** Exit 1
> Stop.
> 
> 
> The problem seems to be the definition of Py_SAFE_DOWNCAST in
> Include/pyport.h
> 
> #ifdef Py_DEBUG
> #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \
>         (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))
> #else
> #define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
> #endif
> 
> 
> I also wrote a simple c program mimicking this behavior:
> 
> #include <stdio.h>
> #include <assert.h>
> 
> 
> #define SAFE_DOWNCAST(VALUE, WIDE, NARROW)  (assert ((WIDE)(NARROW)(VALUE)
> == (VALUE)), (NARROW)(VALUE))
> 
> main () {
> 
>   char p ;
>   int c ;
> 
>   c = 65 ;
>   p = SAFE_DOWNCAST(c, int, char) ;
> 
>   printf ("INT is: %d  and CHAR is: %c\n", c, p) ;
> 
> }
> 
> 
> This program does not seem to compile with the cc or the gcc compilers. Is
> there a problem with my C compilers or the switches I use with them?
> 
> Thanks,
> 
> Narendra


All right do this:

CC="cc -std1 -msg_disable longlongtype"
export CC
( I am assuming you are bourne/Korn shell)
Then run configure again. It will compile fine with or w/o the Debug
option
enabled.
Explanation of the options:
 -std1 : This enforces strict compliance with ANSI C standard. Python
seems to be one of the few apps that I have had success using the
flag. Anyways, it is good thing to be compliant with the standard :) I
guess
 -msg_disable longlongtype:
    All this does is reduce the noise on the long long type being a
language extension (it is Informational and *not* warning btw).

Now, as to why '-std1' would work. I have not had the time to shift
through this. What it does do is define the macro __STDC__ = 1.

cheers



More information about the Python-list mailing list