[New-bugs-announce] [issue1516] make _ctypes work with non-gcc compilers

Greg Couch report at bugs.python.org
Thu Nov 29 01:52:59 CET 2007

New submission from Greg Couch:

To get _ctypes to sucessfully compile with native UNIX compilers (i.e.,
not gcc), several modifications need to be made: (1) use the equivalent
of the Py_GCC_ATTRIBUTE macro for __attribute__ (in ffi.h), (2) include
 <ffi_common.h> in callproc.c to conditionally include <alloca.h>, and
(3) modify distutils to know something about assembly language files.

The attached patch is a starting point for the proper patch.  It fixes
bugs (1) and (2), but I was unable to figure out the last tweek to get
distutils to work with gcc and native compilers.

The problem with _ctypes comes from the use of gcc's libffi.  And libffi
 uses assembly language source files for the various supported platforms
and distutils blindly compiles the .S files.  Native UNIX compilers want
a .s suffix and if the files are renamed, distutils skips the file.  I
tried modifying distutils to compile .s files and give the '-x
assembler-with-cpp' flag to gcc so gcc would still work, but the right
tweek evaded me.  So I'm hoping someone can take this and turn it into
something better or make helpful suggestions (other than switching to gcc!).

files: _ctypes.diffs
messages: 57924
nosy: gregcouch
severity: normal
status: open
title: make _ctypes work with non-gcc compilers
versions: Python 2.6
Added file: http://bugs.python.org/file8819/_ctypes.diffs

Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: _ctypes.diffs
Type: application/octet-stream
Size: 8031 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20071129/b0afaf1b/attachment.obj 

More information about the New-bugs-announce mailing list