[New-bugs-announce] [issue6957] Extension modules fail to build on OS X 10.6 using python.org 2.x/3.x

Ned Deily report at bugs.python.org
Mon Sep 21 13:06:00 CEST 2009


New submission from Ned Deily <nad at acm.org>:

Potential 2.6.3 release blocker

On OS X 10.6 (Snow Leopard), if you attempt to install a package with a 
extension module using a Python from a python.org OS X installer (say, 
2.6.x or 3.1.x), the c compilation steps will likely fail in one of two 
ways:

1. Recent python.org installers are built using the OS X 10.4 SDK so 
that one installer image will work on 10.4, 10.5 and now 10.6 (in 
theory, 10.3.x as well).  Building of extension modules also require gcc 
and the SDKs, which are included as part of Apple's Xcode tools.  
However, with 10.6 Xcode, the 10.4 SDK is not installed by default so 
the extension module build will fail due to missing include files. Once 
the problem is known, it can be solved easily by installing the SDK from 
the release DVD that comes with the system or upgrade.

2. Even with the 10.4 SDK installed on 10.6, the compilation fails with:

/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: 
stdarg.h: No such file or directory

This can be especially baffling to those unfamiliar with nested include 
files because the base file stdarg.h does exist in that directory.

The root cause here is that Snow Leopard now uses gcc-4.2 by default but 
the 10.4 SDK does not include headers for 4.2. The solution is to force 
use of gcc-4.0, the default on 10.4 and 10.5 and included in 10.6, by 
defining the CC environment variable:
 
  $ export CC=/usr/bin/gcc-4.0
  $ python setup.py install 
      or
  $ easy_install xxx

Even for experienced developers, these can be non-trivial problems to 
resolve although the solutions, once known, are easy to implement.  
Unfortunately, all types of python users can run into these issues 
simply by trying to install and use a package that includes an extension 
module.  There are a growing number of hits on the web from people 
trying to install popular packages such as MySQLdb, PIL, and lxml using 
a python.org Python on 10.6.  Note this isn't a problem for users of the 
Apple-supplied Pythons (2.6 and 2.5) on 10.6 since they do not use the 
10.4 SDK.

There are two separate issues here I think:
1. What, if anything, to do for users of installers already out in the 
field?
2. What to do to mitigate the problems for yet-to-be released installers 
(e.g. 2.6.3)?

Documenting and publicizing the problems somehow may be the only viable 
option for 1.  For 2, there is the possibility of some additional 
actions, perhaps a warning in the installer readme or some such.  It 
probably would make sense to contact the maintainers of such packages so 
that they can add something to their web pages and documentation.

----------
assignee: ronaldoussoren
components: Extension Modules, Macintosh
messages: 92930
nosy: ned.deily, ronaldoussoren
severity: normal
status: open
title: Extension modules fail to build on OS X 10.6 using python.org 2.x/3.x
versions: Python 2.6, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6957>
_______________________________________


More information about the New-bugs-announce mailing list