[ sorry, forgot to add CC ]

On Sun, 19 Jun 2011 21:10:17 -0500
"Steve M. Robbins" <st...@sumost.ca> wrote:

> On Mon, Jun 20, 2011 at 01:30:25AM +0200, Cristian Greco wrote:
> 
> > $ python-dbg -c "import libtorrent"
> > Traceback (most recent call last):
> >   File "<string>", line 1, in <module>
> > ImportError: /usr/lib/libboost_python-py26.so.1.46.1: undefined symbol: 
> > Py_InitModule4_64
> > [15005 refs]
> > 
> > This error is obliviously due to the fact boost.python is built against
> > pythonX and not pythonX-dbg.
> 
> This is not obvious to me.  In the past [1], this symptom has been traced to 
> a mismatch
> between the python version used to build Boost and the python version used to 
> build
> the application -- i.e. python-libtorrent.

Yeah, you're right, and in this case the application is
python-libtorrent-dbg instead, i.e. the "debug" extension
libtorrent_d.so built for pythonX-dbg, while the current boost.python
library is build (only) for pythonX.

> I note that python2.6 (2.6.7-1) was recently uploaded.  So first question is: 
> does a
> rebuild of python WITHOUT CHANGES fix the problem?
> 
> 
> The boost python library references Py_InitModule4_64 but does
> not define it:
> 
>   $ objdump --demangle -T /usr/lib/libboost_python-py26.so.1.46.1| grep 
> Py_InitModule4_64
>   0000000000000000      D  *UND*  0000000000000000              
> Py_InitModule4_64
> 
> The python library defines this symbol:
> 
>   $ objdump -T --demangle /usr/lib/libpython2.6.so |grep Py_InitModule4
>   000000000010d970 g    DF .text  00000000000002c7  Base        
> Py_InitModule4_64
> 
> Nothing in /usr/share/doc/python2.6-dbg/README.debug suggests it would be 
> needed to
> define this symbol.

I'm not saying there is something wrong with boost.python as it is now
for "standard" extensions. I'm saying that "debug" extensions (those
built for pythonX-dbg) won't work because they link against the current
boost.python library, which is a "standard" build. We should provide
one more version of boost.python built for pythonX-dbg (i.e. a build
with -I/usr/include/pythonX_d and -DPy_DEBUG defined) so that "debug"
extensions can work properly.

There is no need to rebuild anything in the Python package itself
because the "standard" libtorrent extension works fine as usual (no
output):

$ python -c "import libtorrent"
$ python-dbg -c "import libtorrent"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib/libboost_python-py26.so.1.46.1: undefined symbol:
Py_InitModule4_64 [15005 refs]

My patch proposal builds a "debug" libboost_python-py26-dbg.so.1.46.1
which libtorrent_d.so then links against:

$ python-dbg -c "import libtorrent"
[15005 refs]


Thanks,
--
Cristian Greco
GPG key ID: 0xCF4D32E4

Attachment: signature.asc
Description: PGP signature

Reply via email to