y500 / libtorrent

Automatically exported from code.google.com/p/libtorrent
0 stars 0 forks source link

Python Libtorrent-0.16.18 import fails #700

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I tried to compile libtorrent with python bindings. When I try to import it, it 
fails.

Here is the traceback:

Traceback (most recent call last):
  File "./server.py", line 6, in <module>
    import libtorrent as lt
ImportError: /usr/local/lib/python3.4/dist-packages/libtorrent.cpython-34m.so: 
undefined symbol: _ZN10libtorrent23get_libtorrent_categoryEv

I'm using ubuntu 14.04 with Python3.4

I have tried to compile multiple versions but all have failed to undefined 
symbols, segfaults or byte-encoding errors. Is there a specific version for 
python3.4 that I'm not seeing?

Original issue reported on code.google.com by mcdaseth...@gmail.com on 22 Nov 2014 at 6:19

GoogleCodeExporter commented 8 years ago
how are you building it?

get_libtorrent_category() is supposed to be exported by the main libtorrent.so 
library. Could you verify that it's exporting anything ("nm libtorrent.so")?

perhaps the python binding library can't find the main libtorrent.so library.

When you say "versions" you mean older versions of libtorrent? not different 
build configurations?

Original comment by arvid.no...@gmail.com on 22 Nov 2014 at 6:42

GoogleCodeExporter commented 8 years ago
It was a serious issue with my machine, and not libtorrent-0.16.18. I 
reinstalled and now its fixed, thanks for your help :)

Original comment by mcdaseth...@gmail.com on 22 Nov 2014 at 6:58

GoogleCodeExporter commented 8 years ago
This is how I build it:

./autotool.sh
./configure --enable-python-binding --with-boost-python=mt
make -j4
sudo make install
cd bindings/python
python setup.py build
cp build/lib.macosx-10.9-intel-2.7/libtorrent.so .

I end up with this error:

Symbol not found: __ZN5boost4asio5error16get_ssl_categoryEv.

This is caused by a bug in boost.asio ( https://github.com/boostorg/asio/pull/1 
).

It can be circumvented by one of:

1. disabling the -fvisibility=hidden (which will make libtorrent.so 
significantly larger)
2. by applying the patch in the pull request to boost.asio.
3. building libtorrent and the python binding with static linking ( cd 
bindings/python : b2 link=static stage_module)

The next release of libtorrent will have a convenient switch to the configure 
script to export all symbols, with this patch: http://dpaste.com/2Z8PX3J

Original comment by arvid.no...@gmail.com on 22 Nov 2014 at 7:05

GoogleCodeExporter commented 8 years ago

Original comment by arvid.no...@gmail.com on 23 Nov 2014 at 8:34