linking with shared library, undefined reference to Py_BuildValue

JW jkpangtang at
Thu Mar 6 02:54:54 CET 2003

martin at (Martin v. Löwis) wrote in message news:<m3d6l670ni.fsf at>...
> jkpangtang at (JW) writes:
> > When i try compiling and linking main.c with and libpython2.2.a,
> > i get the following error messages:
> > -->./ - undefined reference 'Py_BuildValue'
> > --> ./ - 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

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 mailing list