The correct way to link Python extensions is to use distutils, end of story. The compiler/linker flags are different for every platform and sometimes differ based upon the way it's built. Specifically in this case all that should be necessary is -undefined dynamic_lookup -- however, the only good fix is to use distutils.
-bob On 12/14/06, Dan White <[EMAIL PROTECTED]> wrote: > Hi, > > Actually i see the same error message using python2.5 when building > ITK python wrapping. > > I was wondering what i am doing wrong that ld is not seeing pytohn > properly to find those symbols? > > Any one know what is going wrong to give error message like > > >> /usr/bin/ld: Undefined symbols: > >> _main > >> _PyArg_ParseTuple > >> _PyInt_FromLong > >> _PyString_FromString > >> _PyTuple_New > >> _PyTuple_SetItem > >> _Py_InitModule4 > >> collect2: ld returned 1 exit status > > which lib or headers or something is ld not seeing? > > cheers > > Dan > > > On 14 Dec 2006, at 13:00, [EMAIL PROTECTED] wrote: > > > From: "Bob Ippolito" <[EMAIL PROTECTED]> > > Date: 14 December 2006 12:28:29 GMT+02:00 > > To: "Gen Kazama" <[EMAIL PROTECTED]> > > Cc: pythonmac-sig@python.org > > Subject: Re: [Pythonmac-SIG] CPython on Mac OSX > > > > > > On 12/13/06, Gen Kazama <[EMAIL PROTECTED]> wrote: > >> Hi I'm running python 2.3 on 10.4. i made an application using a > >> C backend > >> and a python frontend. > >> > >> This is a school project and although it works perfectly on the > >> school > >> computers, i have trouble compiling the C code correctly on the > >> mac to make > >> it into a python module (maybe this is because the school > >> computers used > >> python 2.4-ie, an updated version of Python.h). > >> > >> Anyway here is how I compile it at school: > >> > >> gcc -I /usr/include/python2.4 -c mandel.c > >> gcc -shared mandel.o -o mandel.so > >> > >> which works with no flaws. then , I try compiling it on my mac: > >> > >> gcc -I /usr/include/python2.3 -c mandel.c > >> gcc mandel.o -o mandel.so > >> > >> (note: -shared wasn't found on my mac for some reason). I get the > >> following > >> errors: > >> > >> /usr/bin/ld: Undefined symbols: > >> _main > >> _PyArg_ParseTuple > >> _PyInt_FromLong > >> _PyString_FromString > >> _PyTuple_New > >> _PyTuple_SetItem > >> _Py_InitModule4 > >> collect2: ld returned 1 exit status > >> > >> > >> If anyone could tell me how to compile this C code into a python > >> module on > >> my mac, i would greatly appreciate it. thanks! > > > > The best way is to use distutils (or setuptools). Create a setup.py > > that compiles it for you. This works on every platform, even windows. > > > > -bob > > Dr. Daniel James White BSc. (Hons.) PhD > Bioimaging Coordinator > Nanoscience Centre and Department of Biological and Environmental > Sciences > Division of Molecular Recognition > Ambiotica C242 > PO Box 35 > University of Jyväskylä > Jyväskylä > FIN 40014 > Finland > > +358 14 260 4183 (work) > +358 468102840 (mobile) > http://www.bioimagexd.org > http://www.chalkie.org.uk > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig