linking with shared library, undefined reference to Py_BuildValue
jkpangtang at yahoo.com
Thu Mar 6 02:54:54 CET 2003
martin at v.loewis.de (Martin v. Löwis) wrote in message news:<m3d6l670ni.fsf at mira.informatik.hu-berlin.de>...
> jkpangtang at yahoo.com (JW) writes:
> > When i try compiling and linking main.c with spammodule.so and libpython2.2.a,
> > i get the following error messages:
> > -->./spammodule.so - undefined reference 'Py_BuildValue'
> > --> ./spammodule.so - undefined reference 'Py_InitModule4'
> On Unix, if a static library (such as libpython2.2.a) is incorporated
> into an executable (such as main), symbols from the shared library
> might not be exported to other shared libraries you are also linking
> with. Whether this happens and how to solve it depends on the flavour
> of Unix, but most likely, you need to add -Wl,--export-dynamic to your
> linker command line.
I'm running RedHat 7.2 linux, on x86 platform.
I tried adding the " -Wl,--export-dynamic" to the gcc line,
and I still get same 'undefined reference' errors.
Any other suggestions. Also, does any one have suggestions for good
resource that explains linking/compiling on unix and linux? I'm coming
from Windows programming background.
More information about the Python-list