embedding python, missing symbols

Jack Diederich jack at performancedrivers.com
Sat Jan 25 04:46:48 EST 2003


I can't seem to make gcc happy

using the example main() from the embedding docs and doing

gcc -I<path to Python.h> ./libpython2.2.a example.c

gives the following error

/tmp/ccBiGJVU.o: In function `main':
/tmp/ccBiGJVU.o(.text+0x2d): undefined reference to `Py_Initialize'
/tmp/ccBiGJVU.o(.text+0x3d): undefined reference to `PyString_FromString'
/tmp/ccBiGJVU.o(.text+0x50): undefined reference to `PyImport_Import'
<snip, more of the same>
/tmp/ccBiGJVU.o(.text+0x299): undefined reference to `Py_Finalize'

./libpython2.2.a is a hard link to the one installed in /usr/local 

I tried with python2.2 and 2.3a1
I tried with gcc 2.96 and 3.0.4

redhat 7.1 with recompiled pythons and gccs

grepping the libpython* binaries shows a match for all the symbols

similar errors on groups.google are because the libpython*.a wasn't
included.  I am including the lib ... gcc just doesn't care.

I must be missing something obvious, please let me know what it is!

btw, mod_python and other things compile happilly on the same machine.

TIA,

-jackdied





More information about the Python-list mailing list