[Python-Dev] ctypes and powerpc (original) (raw)

Ronald Oussoren ronaldoussoren at mac.com
Sat Nov 25 08:24:07 CET 2006


On Friday, November 24, 2006, at 08:21PM, "Thomas Heller" <theller at ctypes.org> 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 'fficall', 'ffiprepclosure'. These symbols are defined in file Modules/ctypes/libffi/src/powerpc/ffidarwin.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_GNUCMINOR=9 -DIBMR2 -DPOWER -DAIX -DAIX32 -DAIX41 -DAIX43_ -DAIX51 -DLONGLONG -DIBMR2 -DPOWER -DAIX -DAIX32 -DAIX41 -DAIX43 -DAIX51 -DLONGLONG -Asystem(unix) -Asystem(aix) -D_CHARUNSIGNED_ -DARCHCOM 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 at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com



More information about the Python-Dev mailing list