[Pythonmac-SIG] undefined symbols when making python wrapped c libs for itk

Dan White dan at chalkie.org.uk
Thu Dec 14 15:03:12 CET 2006


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, pythonmac-sig-request at python.org wrote:

> From: "Bob Ippolito" <bob at redivi.com>
> Date: 14 December 2006 12:28:29 GMT+02:00
> To: "Gen Kazama" <generalkernel at gmail.com>
> Cc: pythonmac-sig at python.org
> Subject: Re: [Pythonmac-SIG] CPython on Mac OSX
>
>
> On 12/13/06, Gen Kazama <generalkernel at gmail.com> 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
dan at chalkie.org.uk
white at cc.jyu.fi





More information about the Pythonmac-SIG mailing list