[Pythonmac-SIG] Using distutils with XCode
Paul Kinnane
pkinnane at internode.on.net
Thu Oct 6 03:03:12 CEST 2005
Thanks for this Chris.
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++'). 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.
However, back to the original question....
I want to use the library in MacPython (rather than Darwin python).
MacPython requires a slb library. Simply renaming ode.so to ode.slb
results in a "fragment container format is unknown" error when I do an
"import ode" in the MacPython IDE.
Is there a way to compile the library to a .slb using gcc?
Thanks
Paul
-----Original Message-----
From: Chris Barker [mailto:Chris.Barker at noaa.gov]
Sent: Thursday, 6 October 2005 2:06 AM
To: Paul Kinnane
Cc: pythonmac-sig at python.org
Subject: Re: [Pythonmac-SIG] Using distutils with XCode
Paul,
I don't really have much more to offer here. As I mentioned, I ran into
a similar problem a while back, but never really solved it...I just
converted my C++ code to C. I'm hoping someone that really knows what
they are doing could help.
In the meantime, one thing to try is to look for an extension written in
C++ that does build with setup.py, and see how it is done. Matplotlib
comes top mind, though that's a pretty complex one.
Paul Kinnane wrote:
>>I doubt it. It is in libstdc++
>
> Well I couldn't find any trace of a file called "libstdc*" on my Mac,
so
> maybe it isn't installed?
Weird. On my machine (10.3.?) it's in:
/usr/lib/
It's also in:
/usr/lib/gcc/darwin/3.1
and
/usr/lib/gcc/darwin/3.3
and a couple other places. some of these may be links to others. gcc3.3
is now my system compiler.
> So I replaced the gcc link command with g++, and now when I do "import
> ode" in python I get...
> ImportError: Loaded module does not contain symbol _initode2
>
> Which seems to indicate a problem with the ODE build.
yes, it does look like that. Is there an 'extern "C" ' before the
_initode2() definition?
Is there an _initode2() defined?
Sorry I can't be more help,
-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