[C++-sig] importing issues with c++ shared dynamic libraries (.so)
Tim Spens
t_spens at yahoo.com
Fri Jul 13 18:41:41 CEST 2007
--- Tim Spens <t_spens at yahoo.com> wrote:
> I'm trying to import multiple c++ shared dynamic
> libraries (.so) with inter-dependencies into python.
>
> Then use one of the .so libraries which I've added
> boost.python wrappers to. Here's the out put from
> python...
>
> using boost 1.33
>
> Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for
> more information.
> >>>
> >>> import libxml2
> >>> #libxml2.so imported just fine
> >>>
> >>> import libboost_thread
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: dynamic module does not define init
> function (initlibboost_thread)
> >>>
> >>> import libboost_serialization
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: dynamic module does not define init
> function (initlibboost_serialization)
> >>>
> >>> import libboost_python
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: dynamic module does not define init
> function (initlibboost_python)
> >>>
> >>> import libX
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: dynamic module does not define init
> function (initlibX)
> >>> libX.so is a c++ dynamic shared library with no
> boost.python wrappers
> >>>
> >>> import libShared
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: libShared.so: undefined symbol: xmlFree
> >>> libShared.so is a c++ dynamic shared library
> with
> no boost.python wrappers
> >>>
> >>> import libzee
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: ./libzee.so: undefined symbol:
> _ZTIN5boost10lock_errorE
> >>> libzee.so is a c++ dynamic shared library with
> boost.python wrappers added
>
> I've tried using ld.open but it seems to only allow
> me
> to call specific functions in the libraries and
> doesn't allow the libraries to talk to each other.
>
> Any help will be greatly appreciated.
>
>
I've just learned that I need to only import my
wrapped library, and python should find the libraries
the wrapped lib is dependent upon when it's loaded?
So I added the paths of my c++ libraries and boost
libs to the sys.path and env path, but I still have
the same problem importing my python wrapped c++ lib
because it has dependencies on boost libs.
>>> import libzee
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: ./libzee.so: undefined symbol:
_ZTIN5boost10lock_errorE
____________________________________________________________________________________
Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
More information about the Cplusplus-sig
mailing list