undefined symbols when linking Python into a shared library

Mats Wichmann mats at laplaza.org
Wed Mar 6 10:07:14 EST 2002


On Tue, 05 Mar 2002 23:03:33 +0100, Michael Neuroth
<michael.neuroth at freenet.de> wrote:

:Hello to all python experts,
:
:I have a question about embedding Python in an application.
:To be more precisely, I want to create a shared library which
:holds the python interpreter and some other functions registered
:at the Python interpreter (I used SWIG for that task). This
:shared library (or DLL) will be loaded dynamically from an
:application to support Python as script language.
:
:This way works well for Windows and (for simple scripts which
:do not load other modules) also for Linux.
:
:Unfortunately I get an "undefined symbol" error when I try to
:load other modules with the import statement on Linux.
:When I try to laod Tkiter in a simple test script, I get this
:error message on stderr from the embedded python interpreter:
:
:
:
:  Traceback (most recent call last):
:
:    File "<string>", lind 2, in ?
:
:    File "/usr/lib/python2.1/lib-tk/Tkinter.py", line 35, in ?
:
:      import _tkiter # If this fails your Python my not be configured for Tk
:
:  ImportError: /usr/lib/python2.1/lib-dynload/_tkiter.so: undefined symbol: _Py_NoneStruct


If this is a direct snip, and not a transcription, the problem is sa
typo: _tkiter is used instead of _tkinter


:  How can I verify, that this symbols are in the shared library?

Use objdump on the shared library

Mats Wichmann




More information about the Python-list mailing list