[Pythonmac-SIG] Using distutils with XCode

Paul Kinnane pkinnane at internode.on.net
Fri Oct 7 09:54:17 CEST 2005


Thanks Chris

I'm in the unfortunate position to need to be using Python2.2.  So I
need to get my extension compiled as a .slb.

I got as far as trying to compile the library under MPW (as following
the instructions from
http://www.nevada.edu/~cwebster/Python/MPWHOWTO/MPWHOWTO.html, however
the sample c extension wouldn't compile.  There were a number of missing
include files.  In the end I downloaded GUSI and tried compiling.  The
MPW compiler couldn't find header files there were under folders
included in the include file path (for example, it couldn't find
sys/cdefs.h, even-though sys/cdefs.h is present, in the GUSI include
directory).

I think I've had enough of this little adventure......thanks again for
your help.

Paul

-----Original Message-----
From: Chris Barker [mailto:Chris.Barker at noaa.gov] 
Sent: Thursday, 6 October 2005 2:10 PM
To: Paul Kinnane; pythonmac-sig at python.org
Subject: Re: [Pythonmac-SIG] Using distutils with XCode

Paul Kinnane wrote:
> I have now got the library compiled and working in Dawrin python.  I
> simply compiled and linked with g++ instead of gcc (I did this by
> manually entering the compile and link commands that setup.py was
> issuing, changing "gcc" to "g++').

I'd still like to know how to make distutils do this right...anyone?

>  The resulting file is ode.so, and
> after doing an "install" I can "import ode" and use the library.  The
> "Loaded module does not contain symbol _initode2" error was due to me
> renaming the ode.so library - which appears to be a no-no.

yes, it is a no-no. It is assumed that foo.so will contain an initfoo() 
function to initialize the module.

> I want to use the library in MacPython (rather than Darwin python).

What is MacPython vs. darwin Python? There is now one, unified python. 
You can use 2.3.* or 2.4.*, but either way, it's native OS-X. If you 
want to run it under classic (or on an old pre-OS-X machine), then you 
are talking a different beast, and you're not going to get it with gcc 
under OS-X. gcc only knows how to make mach-o binaries. You'll need CFM 
binaries. Your best bet is probably code warrior, which I don't think is

supported in any way, shape or form by distutils. I used to compile 
python extensions with Code Warrior, and it wasn't too hard. Just the 
usual struggle to include and link all the right files. I think MPW can 
do it too, but I've never tried that.

Now I know why you were looking at those old docs at the beginning of 
this adventure!

Do you really need to run this under Classic?

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer
                                      		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the Pythonmac-SIG mailing list