[Python-Dev] ctypes and powerpc

2006-11-24 Thread Thomas Heller
I'd like to ask for help with an issue which I do not know
how to solve.

Please see this bug http://python.org/sf/1563807
"ctypes built with GCC on AIX 5.3 fails with ld ffi error"

Apparently this is a powerpc machine, ctypes builds but cannot be imported
because of undefined symbols like 'ffi_call', 'ffi_prep_closure'.

These symbols are defined in file
  Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c.
The whole contents of this file is enclosed within a

#ifdef __ppc__
...
#endif

block.  IIRC, this block has been added by Ronald for the
Mac universal build.  Now, it seems that on the AIX machine
the __ppc__ symbols is not defined; removing the #ifdef/#endif
makes the built successful.

We have asked (in the SF bug tracker) for the symbols that are defined;
one guy has executed 'gcc -v -c empty.c' and posted the output, as far as I
see these are the symbols defined in gcc:

-D__GNUC__=2
-D__GNUC_MINOR__=9 -D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_AIX43
-D_AIX51 -D_LONG_LONG -D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_AIX43
-D_AIX51 -D_LONG_LONG -Asystem(unix) -Asystem(aix) -D__CHAR_UNSIGNED__
-D_ARCH_COM

What should we do now?  Should the conditional be changed to

#if defined(__ppc__) || defined(_POWER)

or should we suggest to add '-D__ppc__' to the CFLAGS env var, or what?
Any suggestions?

Thanks,
Thomas

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] ctypes and powerpc

2006-11-24 Thread Thomas Heller
Thomas Heller schrieb:
> I'd like to ask for help with an issue which I do not know
> how to solve.
> 
> Please see this bug http://python.org/sf/1563807
> "ctypes built with GCC on AIX 5.3 fails with ld ffi error"
> 
> Apparently this is a powerpc machine, ctypes builds but cannot be imported
> because of undefined symbols like 'ffi_call', 'ffi_prep_closure'.
> 
> These symbols are defined in file
>   Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c.
> The whole contents of this file is enclosed within a
> 
> #ifdef __ppc__
> ...
> #endif
> 
> block.  IIRC, this block has been added by Ronald for the
> Mac universal build.  Now, it seems that on the AIX machine
> the __ppc__ symbols is not defined; removing the #ifdef/#endif
> makes the built successful.

Of course, the simple solution would be to change it to:

#ifndef __i386__
...
#endif

Thomas

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] ctypes and powerpc

2006-11-24 Thread Martin v. Löwis
Thomas Heller schrieb:
> What should we do now?  Should the conditional be changed to
> 
> #if defined(__ppc__) || defined(_POWER)
> 

This would be the right test, if you want to test for "power-pc
like". POWER and PowerPC are different processor architectures,
IBM pSeries machines (now System p) have POWER processors; this
is the predecessor of the PowerPC architecture (where PowerPC
omitted some POWER features, and added new ones). Recent POWER
processors (POWER3 and later, since 1997) are apparently
PowerPC-compatible. Still, AIX probably continues to define
_POWER for backwards-compatibility (back to RS/6000 times).

Regards,
Martin

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] ctypes and powerpc

2006-11-24 Thread Ronald Oussoren
 
On Friday, November 24, 2006, at 08:21PM, "Thomas Heller" <[EMAIL PROTECTED]> 
wrote:
>I'd like to ask for help with an issue which I do not know
>how to solve.
>
>Please see this bug http://python.org/sf/1563807
>"ctypes built with GCC on AIX 5.3 fails with ld ffi error"
>
>Apparently this is a powerpc machine, ctypes builds but cannot be imported
>because of undefined symbols like 'ffi_call', 'ffi_prep_closure'.
>
>These symbols are defined in file
>  Modules/_ctypes/libffi/src/powerpc/ffi_darwin.c.
>The whole contents of this file is enclosed within a
>
>#ifdef __ppc__
>...
>#endif
>
>block.  IIRC, this block has been added by Ronald for the
>Mac universal build.  Now, it seems that on the AIX machine
>the __ppc__ symbols is not defined; removing the #ifdef/#endif
>makes the built successful.

The defines were indeed added for the universal build and I completely 
overlooked the fact that ffi_darwin.c is also used for AIX. One way to fix this 
is

#if !  (defined(__APPLE__) && !defined(__ppc__))
...
#endif

That is, compile the file unless __APPLE__ is defined but __ppc__ isn't. This 
more clearly documents the intent. 




>
>We have asked (in the SF bug tracker) for the symbols that are defined;
>one guy has executed 'gcc -v -c empty.c' and posted the output, as far as I
>see these are the symbols defined in gcc:
>
>-D__GNUC__=2
>-D__GNUC_MINOR__=9 -D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_AIX43
>-D_AIX51 -D_LONG_LONG -D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_AIX41 -D_AIX43
>-D_AIX51 -D_LONG_LONG -Asystem(unix) -Asystem(aix) -D__CHAR_UNSIGNED__
>-D_ARCH_COM
>
>What should we do now?  Should the conditional be changed to
>
>#if defined(__ppc__) || defined(_POWER)
>
>or should we suggest to add '-D__ppc__' to the CFLAGS env var, or what?
>Any suggestions?
>
>Thanks,
>Thomas
>
>___
>Python-Dev mailing list
>Python-Dev@python.org
>http://mail.python.org/mailman/listinfo/python-dev
>Unsubscribe: 
>http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
>
>
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com