[Python-Dev] Python modules should link to libpython

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Wed Feb 8 16:47:04 CET 2006

gjc:/usr/lib/python2.4/lib-dynload$ ldd itertools.so
        libpthread.so.0 => /lib/libpthread.so.0 (0x00002aaaaabcc000)
        libc.so.6 => /lib/libc.so.6 (0x00002aaaaace2000)
        /lib/ld-linux-x86-64.so.2 (0x0000555555554000)

It seems that Python C extension modules are not linking explicitly to
libpython.  Yet, they explicitly reference symbols defined in libpython.
When libpython is loaded in a global scope all is fine.  However, when
libpython is dlopen()ed with the RTLD_LOCAL flag, python C extensions
always get undefined symbols.

  This problem happened recently with the nautilus-python package, which
installs an extension for the Nautilus file manager that allows
extensions in Python.  For performance reasons, it now opens extensions
with RTLD_LOCAL flag, thus breaking python extensions.

  Any thoughts?  Should I go ahead and open a bug report (maybe with
patch), or is this controversial?

Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic.

More information about the Python-Dev mailing list