[Pythonmac-SIG] Extension module compile fail, due to isysroot param pointing to sdk without certain headers. Any tips?

Irmen de Jong irmen at xs4all.nl
Tue May 3 00:32:51 CEST 2011


On 2-5-2011 22:22, Ronald Oussoren wrote:

> Adding ['-isysroot', '/'] to extra_compile_flags and extra_link_flags for the extension should work.

I wiped everything and started over tonight, and lo and behold, I mananged to get it to
work by adding a custom option to the setup.py script that in effect added
-I/usr/local/include -I/usr/local to the compile command. That fixed the compiler error
where it couldn't find the appropriate header file at first.

> It worries my a little that the OSX 10.4u SDK causes failures for libraries in /usr/local, that
> should work just fine, the SDK should only affect files in system locations (/usr/include and
> /System/Library).
> 
> Which file couldn't be found? It it a file that's also included in OSX?  Can you reproduce the
> problem with a self-contained example that you can share?

I wanted to build gevent and it needs the headers from libevent.
I compiled and installed libevent into /usr/local. At first those headers could not be
found when building gevent. It worked with the custom setup.py option that I mentioned
above (--libevent /usr/local)... but I swear last night I couldn't get it to work no
matter what I tried.
I remember tweaking the compiler options and such but it always failed with not finding
the libevent headers, or stdarg.h (weird, because that file is available everywhere??).
Unfortunately it seems I cannot reproduce my initial problems, I should have saved my
console logs of last night :(


I still see a problem when you are not installing by hand, but with PIP or easy_install.
When you are installing a package with a weird setup script like gevent, using PIP, you
hit a barrier. Because I cannot tweak the setup.py script that PIP will be running (and
the --install-option of PIP didn't do what the setup.py script wanted, I tried it but
the setup.py didn't like it in any shape or form)

I'm comfortable with developing in a unix like environment but the sysroot/sdk stuff of
OS X is a bit alien to me. Am I supposed to not touch the SDK locations at all? So
installing custom libraries should always be done into /usr/local and then referred to
by adding explicit -I/usr/local flags to the compile command?


Thanks for your time.

Irmen de Jong


More information about the Pythonmac-SIG mailing list