Please provide the following information
libtorrent version (or branch):
RC_1_2
platform/architecture:
Linux x64
compiler and compiler version:
gcc version 9.2.0
boost 1.71.0
cmake version 3.16
I built libtorrent together with the python bindings but I get this error when trying to import it:
ImportError: /usr/lib/python3.8/site-packages/libtorrent.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN10libtorrent3aux14proxy_settingsC1Ev
when using libtorrent from python, there are two binaries involved. There's the python module (which is a shared library) and there's the underlying libtorrent library (also, typically, a shared library). The python module links against the libtorrent library. If you built both from source, it's critical you make sure that you don't have any other version of the libtorrent library installed.
The error you're experiencing could happen if the python module and the underlying library are built with different configurations or if they come from different versions of libtorrent.
you could try using the ldd tool on the python module to see which libtorrent library it links against.
I actually just used the @Chocobo1 maintained package for Arch at https://aur.archlinux.org/packages/libtorrent-rasterbar-1_2-git/, where the build details are specified by the PKGBUILD file.
I don't have any other version of libtorrent installed.
Running
ldd /usr/lib/python3.8/site-packages/libtorrent.cpython-38-x86_64-linux-gnu.so
gives
linux-vdso.so.1 (0x00007ffc9f3dd000)
libtorrent-rasterbar.so.10 => /usr/lib/libtorrent-rasterbar.so.10 (0x00007fa706a01000)
libboost_python38.so.1.71.0 => /usr/lib/libboost_python38.so.1.71.0 (0x00007fa7069c1000)
libpython3.8.so.1.0 => /usr/lib/libpython3.8.so.1.0 (0x00007fa70664b000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fa706629000)
libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fa706358000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fa70616e000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fa706152000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fa705f8b000)
libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007fa705efb000)
/usr/lib64/ld-linux-x86-64.so.2 (0x00007fa7072e7000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fa705ef0000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fa705eeb000)
libutil.so.1 => /usr/lib/libutil.so.1 (0x00007fa705ee6000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fa705d9e000)
Same for me on Ubuntu 19.10 armhf using the latest build from https://launchpad.net/~libtorrent.org/+archive/ubuntu/1.2-daily :
ldd /usr/lib/python3/dist-packages/libtorrent.cpython-37m-arm-linux-gnueabihf.so
linux-vdso.so.1 (0xbefb4000)
libtorrent-rasterbar.so.10 => /usr/lib/arm-linux-gnueabihf/libtorrent-rasterbar.so.10 (0xb6ac7000)
libboost_system.so.1.67.0 => /usr/lib/arm-linux-gnueabihf/libboost_system.so.1.67.0 (0xb6ab3000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6a8d000)
libboost_python37.so.1.67.0 => /usr/lib/arm-linux-gnueabihf/libboost_python37.so.1.67.0 (0xb6a52000)
libcrypto.so.1.1 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1 (0xb68a7000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb6758000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb672e000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6631000)
/lib/ld-linux-armhf.so.3 (0xb6eda000)
libssl.so.1.1 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1 (0xb65ce000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6565000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6552000)
Reproduce
new Ubuntu 18.04 LTS
1.
apt update
add-apt-repository ppa:libtorrent.org/1.2-daily -y
apt install -y python3-libtorrent
root@ubuntu-s-1vcpu-1gb-sfo2-01:~# python3
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
Segmentation fault (core dumped)
2.
FROM ubuntu:latest
RUN apt-get update && apt-get install --no-install-recommends -y \
gcc \
python3 \
python3-dev \
python3-pip \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
RUN add-apt-repository ppa:libtorrent.org/1.2-daily -y \
&& apt install -y python3-libtorrent
root@docker-desktop:/opt# python3.6
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python3/dist-packages/libtorrent.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN10libtorrent3aux14proxy_settingsC1Ev
>>>
test.py
import libtorrent as lt
root@ubuntu-s-1vcpu-1gb-sfo2-01:~# gdb
(gdb) file python3
Reading symbols from python3...(no debugging symbols found)...done.
(gdb) run /root/test.py //
Starting program: /usr/bin/python3 /root/test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: Corrupted shared library list: 0x1555555549f0 != 0xb436b0
Program received signal SIGSEGV, Segmentation fault.
0x0000155550a002a9 in GlobalError::PushToStack() () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
confirm
~ $ deluged
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/deluge/_libtorrent.py", line 23, in <module>
import deluge.libtorrent as lt
ModuleNotFoundError: No module named 'deluge.libtorrent'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/deluged", line 11, in <module>
load_entry_point('deluge==2.0.4.dev23', 'console_scripts', 'deluged')()
File "/usr/lib/python3.7/site-packages/deluge/core/daemon_entry.py", line 90, in start_daemon
from deluge.core.daemon import is_daemon_running
File "/usr/lib/python3.7/site-packages/deluge/core/daemon.py", line 22, in <module>
from deluge.core.core import Core
File "/usr/lib/python3.7/site-packages/deluge/core/core.py", line 28, in <module>
from deluge._libtorrent import LT_VERSION, lt
File "/usr/lib/python3.7/site-packages/deluge/_libtorrent.py", line 25, in <module>
import libtorrent as lt
ImportError: /usr/lib/python3.7/site-packages/libtorrent.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN10libtorrent3aux14proxy_settingsC1Ev
it seems to me that these problems are not inherently in libtorrent, but they are caused by the way libtorrent is built. So, the way I can interpret this ticket (being filed against libtorrent) is that either it was meant to point out how there's a problem with @Chocobo1 's PPA, or that there's some issue with the build scripts in libtorrent. But it seems mostly like the former to me.
I think I'm the only one using that package build, the Ubuntu binaries seem to be independent and exhibit the same issue apparently.
looking closer at this, I think this is an issue I introduced recently. Fortunately there hasn't been an official release yet. I will fix it now
I believe this will fix it: https://github.com/arvidn/libtorrent/pull/4139
please let me know if the next nightly build works!
The problem has been fixed, thanks.
apt update
add-apt-repository ppa:libtorrent.org/1.2-daily -y
apt install -y python3-libtorrent
thanks for reporting! (and being persistent)
Can confirm on my side too !
Removing libtorrent-dev installed via apt solved my problem
Most helpful comment
I believe this will fix it: https://github.com/arvidn/libtorrent/pull/4139