[Pythonmac-SIG] Module build fails because distutils adds "-isysroot"
Dave Peterson
dpeterson at enthought.com
Wed Sep 30 18:17:04 CEST 2009
Hi Patrick,
Patrick Näf wrote:
> ... my module's
> build fails miserably, like this:
>
> tharbad:~ patrick$
> /Library/Frameworks/Python.framework/Versions/3.1/bin/python3.1 ./setup.py
> build_ext --inplace
> running build_ext
> building 'aprmd5' extension
> gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
> -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3
> -I/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -c
> aprmd5.c -o build/temp.macosx-10.3-fat-3.1/aprmd5.o
> aprmd5.c:43:60: aprmd5.c:43:60: error: apr-1/apr_md5.h: No such file or
> directory
> [...]
>
> The problem here is that the gcc option "-isysroot" moves the root for
> system includes to the SDK directory (/Developer/SDKs/MacOSX10.4u.sdk),
> away from the normal root (/). Unfortunately, the SDK does not contain the
> header <apr-1/apr_md5.h>, which causes the build to fail. Where does
> "-isysroot" come from? Not from my module, it's added automatically by
> distutils.
>
The options distutils uses come from the file at <python env
root>/lib/python2.5/config/Makefile. I don't think there is any
distutils API provided to override/change these, just ways to append to
them when specifying your extension configuration. These options are
used because they are the same ones used when building that Python
distribution.
So my first suggestion is that you try redefining the -isysroot option
in the flags you can specify in your extension's config. There is a
good chance the compiler will use the last specification on the line
rather than doing something else when it gets two values.
If that doesn't work, the only other thing I can think of is to
temporarily edit the config/Makefile to remove / change the inclusion of
the -isysroot option.
HTHs,
-- Dave
More information about the Pythonmac-SIG
mailing list