linking with shared library, undefined reference to Py_BuildValue

Martin v. Löwis martin at v.loewis.de
Wed Mar 5 02:06:25 EST 2003


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.

HTH,
Martin






More information about the Python-list mailing list