[Pythonmac-SIG] Embedded Python compiling help
Michael Gaiman
mgaiman at gwu.edu
Sun Nov 21 15:52:42 CET 2004
Thanks for your help, Bob.
The gcc command it had me gave me is
gcc -o runfunc run-func.c -fno-strict-aliasing -Wno-long-double
-no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3
-Wall -Wstrict-prototypes -I.
-I/private/var/tmp/python/python-7.obj~4/python/Include
-DPy_BUILD_CORE
-I/System/Library/Frameworks/Python.framework/Versions/2.3/include/
python2.3
which produces the following output:
ld: Undefined symbols:
_PyCallable_Check
_PyDict_GetItemString
_PyErr_Occurred
_PyErr_Print
_PyImport_Import
_PyInt_AsLong
_PyInt_FromLong
_PyModule_GetDict
_PyObject_CallObject
_PyString_FromString
_PyTuple_New
_PyTuple_SetItem
_Py_Finalize
_Py_Initialize
Sorry if I'm missing something super obvious, I've not really spend too
much time with gcc.
Thanks,
Mike
On Nov 21, 2004, at 3:50 AM, Bob Ippolito wrote:
>
> On Nov 21, 2004, at 10:39 AM, Bob Ippolito wrote:
>
>>
>> On Nov 21, 2004, at 4:41 AM, Michael Gaiman wrote:
>>
>>> Hi All,
>>>
>>> I'm getting started embedding python for a school project. I am
>>> starting by getting the program listed in
>>> http://docs.python.org/ext/pure-embedding.html. The next step is
>>> compiling. I've tried quite a few gcc commands, but no dice. The
>>> latest command I've tried is
>>>
>>> gcc
>>> -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/
>>> python2.3
>>> -L/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
>>> python2.3/config -o runfunc run-func.c which fails due to undefined
>>> symbols.
>>>
>>> If anybody could take a minute and list the correct gcc command to
>>> compile and link this program, I would be very grateful.
>>>
>>> I'm using MacOSX 10.3.6 with the built in python.
>>
>> gcc -o runfunc run-func.c `python -c "import
>> distutils.sysconfig;print
>> distutils.sysconfig.get_config_var('PY_CFLAGS')"`
>
> er.. that's not it, but it's close.. you probably also need the output
> of print '-I' + distutils.sysconfig.get_config_var('INCLUDEPY')
>
> -bob
>
More information about the Pythonmac-SIG
mailing list