Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting crashes (SIGABRT) on NetBSD 10.0 + Python 3.7 #7694

Open
hellium6 opened this issue Jun 28, 2024 · 1 comment
Open

Getting crashes (SIGABRT) on NetBSD 10.0 + Python 3.7 #7694

hellium6 opened this issue Jun 28, 2024 · 1 comment

Comments

@hellium6
Copy link

libtorrent version (or branch): v2.0.10

platform/architecture: NetBSD 10.0 amd64

compiler and compiler version: gcc (nb3 20231008) 10.5.0

My process is described in detail below. When I run python3.7 -c 'import libtorrent' it shows Abort trap (core dumped)

Here is a gdb backtrace:

#0  0x00007d2cd0f7e74a in _lwp_kill () from /usr/lib/libc.so.12
#1  0x00007d2cd0e48fa4 in __libc_mutex_unlock_stub () from /usr/lib/libc.so.12
#2  0x00007d2ccfc16e93 in boost::asio::ssl::detail::openssl_init_base::instance() () from /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so
#3  0x00007d2ccfbfa5ce in _GLOBAL__sub_I_converters.cpp () from /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so
#4  0x00007f7f3ba06416 in _rtld_call_init_function () from /usr/libexec/ld.elf_so
#5  0x00007f7f3ba0675c in _rtld_call_init_functions () from /usr/libexec/ld.elf_so
#6  0x00007f7f3ba07698 in dlopen () from /usr/libexec/ld.elf_so
#7  0x00007d2cd2966370 in _PyImport_FindSharedFuncptr () from /usr/pkg/lib/libpython3.7.so.1.0
#8  0x00007d2cd293df27 in _PyImport_LoadDynamicModuleWithSpec () from /usr/pkg/lib/libpython3.7.so.1.0
#9  0x00007d2cd293c1d8 in _imp_create_dynamic () from /usr/pkg/lib/libpython3.7.so.1.0
#10 0x00007d2cd28826af in _PyMethodDef_RawFastCallDict () from /usr/pkg/lib/libpython3.7.so.1.0
#11 0x00007d2cd288277a in _PyCFunction_FastCallDict () from /usr/pkg/lib/libpython3.7.so.1.0
#12 0x00007d2cd29c08c8 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#13 0x00007d2cd29262de in _PyEval_EvalCodeWithName () from /usr/pkg/lib/libpython3.7.so.1.0
#14 0x00007d2cd2881af9 in _PyFunction_FastCallKeywords () from /usr/pkg/lib/libpython3.7.so.1.0
#15 0x00007d2cd29b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#16 0x00007d2cd29bf90a in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#17 0x00007d2cd29b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#18 0x00007d2cd29b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#19 0x00007d2cd29be0c1 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#20 0x00007d2cd29b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#21 0x00007d2cd29b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#22 0x00007d2cd29bd1c0 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#23 0x00007d2cd29b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#24 0x00007d2cd29b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#25 0x00007d2cd29bd1c0 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#26 0x00007d2cd29b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#27 0x00007d2cd29b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#28 0x00007d2cd29bd1c0 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#29 0x00007d2cd29b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#30 0x00007d2cd2883487 in object_vacall () from /usr/pkg/lib/libpython3.7.so.1.0
#31 0x00007d2cd2883730 in _PyObject_CallMethodIdObjArgs () from /usr/pkg/lib/libpython3.7.so.1.0
#32 0x00007d2cd293d104 in PyImport_ImportModuleLevelObject () from /usr/pkg/lib/libpython3.7.so.1.0
#33 0x00007d2cd29c0a21 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#34 0x00007d2cd29262de in _PyEval_EvalCodeWithName () from /usr/pkg/lib/libpython3.7.so.1.0
#35 0x00007d2cd2926576 in PyEval_EvalCodeEx () from /usr/pkg/lib/libpython3.7.so.1.0
#36 0x00007d2cd29265c0 in PyEval_EvalCode () from /usr/pkg/lib/libpython3.7.so.1.0
#37 0x00007d2cd294ef3a in run_mod () from /usr/pkg/lib/libpython3.7.so.1.0
#38 0x00007d2cd295076e in PyRun_StringFlags () from /usr/pkg/lib/libpython3.7.so.1.0
#39 0x00007d2cd29507cc in PyRun_SimpleStringFlags () from /usr/pkg/lib/libpython3.7.so.1.0
#40 0x00007d2cd296c4fd in pymain_main () from /usr/pkg/lib/libpython3.7.so.1.0
#41 0x00007d2cd296cd26 in _Py_UnixMain () from /usr/pkg/lib/libpython3.7.so.1.0
#42 0x0000000066400aad in _start ()

The same process followed for Python 3.11.8 from NetBSD repos did not crash.

I need v2.0.6 to work, but for reporting I'm going with the latest release, v2.0.10.

I installed python 3.7.17 from this commit of NetBSD/pkgsrc. Apart from adding some CFLAGS and LDFLAGS in Makefile there is not much difference. Something like:

git clone --depth 1 -b 01db152b21d3830339e882468c3c0451ffe918ca https://github.com/NetBSD/pkgsrc
cd pkgsrc/lang/python37
bmake package
doas bmake install || doas bmake replace
Details on build here
$ uname -mrs
NetBSD 10.0 amd64

cd ~
mkdir test
cd test

git clone --depth 1 -b OpenSSL_1_1_1w https://github.com/openssl/openssl
cd openssl
git switch -c clone  #fix detached HEAD
git submodule update --init --recursive --depth 1
./config -fPIC -shared --prefix=/usr/local/custom
gmake  #GNU Make
doas gmake all install_sw
cd ..

$ cc --version
cc (nb3 20231008) 10.5.0
...

$ cat ~/user-config.jam
using python : 3.7 ;
using gcc : fail : /dev/null : ; # It will fail. To test if this is ever selected (wrongfully).
# gnu++14 for NetBSD alloca() GNU extensions - https://github.com/tstack/lnav/issues/1158
using gcc : test : g++ : <cxxflags>-std=gnu++14 <cxxflags>-fPIC <crypto>openssl <compileflags>-I/usr/local/custom/include <linkflags>-L/usr/local/custom/lib <linkflags>-Wl,-R/usr/local/custom/lib ;

$ gcc --version
gcc (nb3 20231008) 10.5.0
$ python3.7 --version
Python 3.7.17

curl -LO https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
tar -xvf boost-1.84.0.tar.xz
cd boost-1.84.0
export BOOST_ROOT=$PWD
export BOOST_BUILD_PATH=$BOOST_ROOT/tools/build
cd $BOOST_BUILD_PATH
./bootstrap.sh
doas ./b2 install
cd $BOOST_ROOT
b2 toolset=gcc-test pch=off variant=debug
doas b2 toolset=gcc-test pch=off variant=debug install --prefix=/usr/local/custom


curl -LO https://github.com/arvidn/libtorrent/releases/download/v2.0.10/libtorrent-rasterbar-2.0.10.tar.gz
tar -xvf libtorrent-rasterbar-2.0.10.tar.gz
cd libtorrent-rasterbar-2.0.10

# I) fix for pthread_np.h not found
$ cat fix.patch
This patch is a fix for "fatal error: pthread_np.h: No such file or directory" on NetBSD
Based on:
https://github.com/NetBSD/pkgsrc/commit/2d1e5065b5bdeec046025bf4bf25a37cd344cd64#diff-ef0645b95bcbcc7ceee1cf25ce8b42799ce0b36157a0ea20252e9170d0fa3a45

--- src/platform_util.cpp.orig	2024-06-25 12:02:05.623242181 +0000
+++ src/platform_util.cpp	2024-06-25 12:04:13.293242181 +0000
@@ -40,7 +40,7 @@
 
 #if TORRENT_HAS_PTHREAD_SET_NAME
 #include <pthread.h>
-#ifdef TORRENT_BSD
+#if defined(TORRENT_BSD) && !defined(__NetBSD__)
 #include <pthread_np.h>
 #endif
 #endif
@@ -105,7 +105,11 @@
 		TORRENT_UNUSED(name);
 #if TORRENT_HAS_PTHREAD_SET_NAME
 #ifdef TORRENT_BSD
+#if defined(__NetBSD__)
+		pthread_setname_np(pthread_self(), name, nullptr);
+#else
 		pthread_set_name_np(pthread_self(), name);
+#endif
 #else
 		pthread_setname_np(pthread_self(), name);
 #endif

$ patch < fix.patch

# II)Without these, cxxstd=14 (c++14) is set and gnu++14 cannot be used. GCC GNU
# Extensions are needed for NetBSD alloca() as described above.
sed -i'.bak' -e '/local CXXVER/,+5d' -e 's/<cxxstd>14//g' Jamfile
sed -i'.bak' -e 's/<cxxstd>14//g' bindings/python/Jamfile

# III) Also comment library_dirs related lines to ensure that our "library-path"
# is used for lssl and lcrypt. library-path would then add our
# /usr/local/custom before other "-L"s. For the rest we'll add a -L/usr/pkg/lib
# in the build_ext command at the end just in case.
sed -i'.bak' -e '/for path in self/ s/./#&/' -e '/f"library-path/ s/./#&/' bindings/python/setup.py

b2 toolset=gcc-test variant=debug link=shared crypto=openssl warnings=off address-model=64
doas b2 toolset=gcc-test variant=debug link=shared crypto=openssl warnings=off address-model=64 install --prefix=/usr/local/custom


python3.7 setup.py build_ext --b2-args="toolset=gcc-test variant=debug crypto=openssl cxxflags=-I/usr/local/custom/include cxxflags=-L/usr/local/custom/lib cxxflags=-Wl,-R/usr/local/custom/lib cxxflags=-L/usr/pkg/lib library-path=/usr/local/custom/lib" install --prefix=~/.local

It ended with:

Extracting libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg to /home/user/.local/lib/python3.7/site-packages
Adding libtorrent 0.0.0 to easy-install.pth file

Installed /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg
Processing dependencies for libtorrent==0.0.0
Finished processing dependencies for libtorrent==0.0.0

Details about installed files:

$ tree ~/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/
/home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/
|-- EGG-INFO
|   |-- PKG-INFO
|   |-- SOURCES.txt
|   |-- dependency_links.txt
|   |-- native_libs.txt
|   |-- not-zip-safe
|   `-- top_level.txt
`-- libtorrent
    |-- __init__.py
    |-- __init__.so
    `-- __pycache__
        `-- __init__.cpython-37.pyc

3 directories, 9 files
$ ldd ~/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so 
/home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so:
	-lssl.1.1 => /usr/local/custom/lib/libssl.so.1.1
	-lcrypto.1.1 => /usr/local/custom/lib/libcrypto.so.1.1
	-lpthread.1 => /usr/lib/libpthread.so.1
	-lc.12 => /usr/lib/libc.so.12
	-lutil.7 => /usr/lib/libutil.so.7
	-lstdc++.9 => /usr/lib/libstdc++.so.9
	-lm.0 => /usr/lib/libm.so.0
	-lgcc_s.1 => /usr/lib/libgcc_s.so.1

Test:

$ python3.7 -c 'import libtorrent'
Abort trap (core dumped)
# After repeating the build for python 3.11
$ python3.11 -c 'import libtorrent'
$  # no crash

bt

$ gdb -ex "set pagination off" -ex "backtrace" -ex "quit" `which python3.7` python3.7.core
GNU gdb (GDB) 11.0.50.20200914-git
...
Reading symbols from /usr/pkg/bin/python3.7...
(No debugging symbols found in /usr/pkg/bin/python3.7)
[New process 21096]
Core was generated by `python3.7'.
Program terminated with signal SIGABRT, Aborted.
#0  0x000073f26cb7e74a in _lwp_kill () from /usr/lib/libc.so.12
#0  0x000073f26cb7e74a in _lwp_kill () from /usr/lib/libc.so.12
#1  0x000073f26ca48fa4 in __libc_mutex_unlock_stub () from /usr/lib/libc.so.12
#2  0x000073f26ab78213 in __gthread_active_p () at /usr/include/g++/bits/gthr-posix.h:201
#3  0x000073f26b00be26 in __gnu_cxx::__atomic_add_dispatch (__val=1, __mem=0x73f26dffa908) at /usr/include/g++/ext/atomicity.h:94
#4  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy (this=0x73f26dffa900) at /usr/include/g++/bits/shared_ptr_base.h:142
#5  0x000073f26b00b6d1 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count (this=0x73f26bef8c48 <boost::asio::ssl::detail::openssl_init<true>::instance_+8>, __r=...) at /usr/include/g++/bits/shared_ptr_base.h:743
#6  0x000073f26b024c61 in std::__shared_ptr<boost::asio::ssl::detail::openssl_init_base::do_init, (__gnu_cxx::_Lock_policy)2>::__shared_ptr (this=0x73f26bef8c40 <boost::asio::ssl::detail::openssl_init<true>::instance_>) at /usr/include/g++/bits/shared_ptr_base.h:1186
#7  0x000073f26b024c8b in std::shared_ptr<boost::asio::ssl::detail::openssl_init_base::do_init>::shared_ptr (this=0x73f26bef8c40 <boost::asio::ssl::detail::openssl_init<true>::instance_>) at /usr/include/g++/bits/shared_ptr.h:149
#8  0x000073f26b024d3b in boost::asio::ssl::detail::openssl_init_base::instance () at /usr/local/custom/include/boost/asio/ssl/detail/impl/openssl_init.ipp:152
#9  0x000073f26b025ff5 in boost::asio::ssl::detail::openssl_init<true>::openssl_init (this=0x73f26bef8c40 <boost::asio::ssl::detail::openssl_init<true>::instance_>) at /usr/local/custom/include/boost/asio/ssl/detail/openssl_init.hpp:60
#10 0x000073f26ab798d9 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /usr/local/custom/include/boost/asio/ssl/detail/openssl_init.hpp:90
#11 0x000073f26ab79c9c in _GLOBAL__sub_I_converters.cpp(void) () at src/converters.cpp:559
#12 0x00007f7ec4c06416 in _rtld_call_init_function () from /usr/libexec/ld.elf_so
#13 0x00007f7ec4c0675c in _rtld_call_init_functions () from /usr/libexec/ld.elf_so
#14 0x00007f7ec4c07698 in dlopen () from /usr/libexec/ld.elf_so
#15 0x000073f26e566370 in _PyImport_FindSharedFuncptr () from /usr/pkg/lib/libpython3.7.so.1.0
#16 0x000073f26e53df27 in _PyImport_LoadDynamicModuleWithSpec () from /usr/pkg/lib/libpython3.7.so.1.0
#17 0x000073f26e53c1d8 in _imp_create_dynamic () from /usr/pkg/lib/libpython3.7.so.1.0
#18 0x000073f26e4826af in _PyMethodDef_RawFastCallDict () from /usr/pkg/lib/libpython3.7.so.1.0
#19 0x000073f26e48277a in _PyCFunction_FastCallDict () from /usr/pkg/lib/libpython3.7.so.1.0
#20 0x000073f26e5c08c8 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#21 0x000073f26e5262de in _PyEval_EvalCodeWithName () from /usr/pkg/lib/libpython3.7.so.1.0
#22 0x000073f26e481af9 in _PyFunction_FastCallKeywords () from /usr/pkg/lib/libpython3.7.so.1.0
#23 0x000073f26e5b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#24 0x000073f26e5bf90a in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#25 0x000073f26e5b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#26 0x000073f26e5b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#27 0x000073f26e5be0c1 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#28 0x000073f26e5b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#29 0x000073f26e5b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#30 0x000073f26e5bd1c0 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#31 0x000073f26e5b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#32 0x000073f26e5b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#33 0x000073f26e5bd1c0 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#34 0x000073f26e5b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#35 0x000073f26e5b87d2 in call_function () from /usr/pkg/lib/libpython3.7.so.1.0
#36 0x000073f26e5bd1c0 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#37 0x000073f26e5b76e8 in function_code_fastcall () from /usr/pkg/lib/libpython3.7.so.1.0
#38 0x000073f26e483487 in object_vacall () from /usr/pkg/lib/libpython3.7.so.1.0
#39 0x000073f26e483730 in _PyObject_CallMethodIdObjArgs () from /usr/pkg/lib/libpython3.7.so.1.0
#40 0x000073f26e53d104 in PyImport_ImportModuleLevelObject () from /usr/pkg/lib/libpython3.7.so.1.0
#41 0x000073f26e5c0a21 in _PyEval_EvalFrameDefault () from /usr/pkg/lib/libpython3.7.so.1.0
#42 0x000073f26e5262de in _PyEval_EvalCodeWithName () from /usr/pkg/lib/libpython3.7.so.1.0
#43 0x000073f26e526576 in PyEval_EvalCodeEx () from /usr/pkg/lib/libpython3.7.so.1.0
#44 0x000073f26e5265c0 in PyEval_EvalCode () from /usr/pkg/lib/libpython3.7.so.1.0
#45 0x000073f26e54ef3a in run_mod () from /usr/pkg/lib/libpython3.7.so.1.0
#46 0x000073f26e55076e in PyRun_StringFlags () from /usr/pkg/lib/libpython3.7.so.1.0
#47 0x000073f26e5507cc in PyRun_SimpleStringFlags () from /usr/pkg/lib/libpython3.7.so.1.0
#48 0x000073f26e56c4fd in pymain_main () from /usr/pkg/lib/libpython3.7.so.1.0
#49 0x000073f26e56cd26 in _Py_UnixMain () from /usr/pkg/lib/libpython3.7.so.1.0
#50 0x00000000f0000aad in _start ()
@hellium6
Copy link
Author

hellium6 commented Jul 5, 2024

It seems I reached a dead end with this.

Trial #2: openssl-lib and openssl-include

Adding these args didn't help:

$ python3.7 setup.py build_ext --b2-args="toolset=gcc-test variant=debug crypto=openssl openssl-lib=/usr/local/custom/lib openssl-include=/usr/local/custom/include cxxflags=-I/usr/local/custom/include cxxflags=-L/usr/local/custom/lib cxxflags=-Wl,-R/usr/local/custom/lib cxxflags=-L/usr/pkg/lib library-path=/usr/local/custom/lib" install --prefix=~/.local
...
Adding libtorrent 0.0.0 to easy-install.pth file

Installed /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg
Processing dependencies for libtorrent==0.0.0
Finished processing dependencies for libtorrent==0.0.0
$ ldd /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so
/home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so:
	-lssl.1.1 => /usr/local/custom/lib/libssl.so.1.1
	-lcrypto.1.1 => /usr/local/custom/lib/libcrypto.so.1.1
	-lpthread.1 => /usr/lib/libpthread.so.1
	-lc.12 => /usr/lib/libc.so.12
	-lutil.7 => /usr/lib/libutil.so.7
	-lstdc++.9 => /usr/lib/libstdc++.so.9
	-lm.0 => /usr/lib/libm.so.0
	-lgcc_s.1 => /usr/lib/libgcc_s.so.1
$ python3.7 -c 'import libtorrent'
Abort trap (core dumped)  # with similar bt

Before trying this out, I did another trial reverting the change (III) and trying the same command. It didn't work properly:

$ ldd /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so 
/home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so:
	-lssl.3 => not found
	-lcrypto.3 => not found
	-lpthread.1 => /usr/lib/libpthread.so.1
	-lc.12 => /usr/lib/libc.so.12
	-lutil.7 => /usr/lib/libutil.so.7
	-lstdc++.9 => /usr/lib/libstdc++.so.9
	-lm.0 => /usr/lib/libm.so.0
	-lgcc_s.1 => /usr/lib/libgcc_s.so.1

So I came back to the state with change (III) applied as in first post.

Trial #3: Building Python with OpenSSL 1.x

I wanted to test if the crash was due to python 3.7 system package being built with OpenSSL (3.x) and using another version of OpenSSL (1.1.1w) for libtorrent. I have to use 1.x because the project I'm trying to build requires cryptography==2.5 and it doesn't work with OpenSSL 3.x. So I built python 3.7.17 (debug) from source, using -with-openssl= arg to use 1.1.1w.

Result:

$ python3.7 -c "import ssl; print(ssl.OPENSSL_VERSION)"  # installed through pkgsrc
OpenSSL 3.0.12 24 Oct 2023
$ /usr/local/python37/bin/python3.7 -c "import ssl; print(ssl.OPENSSL_VERSION)"  # built from source
OpenSSL 1.1.1w  11 Sep 2023
$ /usr/local/python37/bin/python3.7 -m sysconfig | grep ABIFLAGS
	ABIFLAGS = "dm"

Changed the using python : 3.7 ; line in user-config.jam to:

using python : 3.7 : /usr/local/python37 : /usr/local/python37/include/python3.7dm :  : <python-debugging>on ;

Then:

/usr/local/python37/bin/python3.7 setup.py build_ext --b2-args="toolset=gcc-test variant=debug crypto=openssl openssl-lib=/usr/local/custom/lib openssl-include=/usr/local/custom/include cxxflags=-I/usr/local/custom/include cxxflags=-L/usr/local/custom/lib cxxflags=-Wl,-R/usr/local/custom/lib cxxflags=-L/usr/pkg/lib library-path=/usr/local/custom/lib" install --prefix=~/.local

The crash remains as is.

$ /usr/local/python37/bin/python3.7 -c 'import libtorrent'
Abort trap (core dumped)
gdb bt here
$ gdb -ex 'set pagination off' -ex 'backtrace' -ex 'quit' /usr/local/python37/bin/python3.7 python3.7.core 
GNU gdb (GDB) 11.0.50.20200914-git
...
Reading symbols from /usr/local/python37/bin/python3.7...
[New process 17697]
Core was generated by `python3.7'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007ca413b7e74a in _lwp_kill () from /usr/lib/libc.so.12
#0  0x00007ca413b7e74a in _lwp_kill () from /usr/lib/libc.so.12
#1  0x00007ca413a48fa4 in __libc_mutex_unlock_stub () from /usr/lib/libc.so.12
#2  0x00007ca411b78233 in __gthread_active_p () at /usr/include/g++/bits/gthr-posix.h:201
#3  0x00007ca41200bf22 in __gnu_cxx::__atomic_add_dispatch (__val=1, __mem=0x7ca415a61548) at /usr/include/g++/ext/atomicity.h:94
#4  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy (this=0x7ca415a61540) at /usr/include/g++/bits/shared_ptr_base.h:142
#5  0x00007ca41200b7cd in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count (this=0x7ca412ef9a08 <boost::asio::ssl::detail::openssl_init<true>::instance_+8>, __r=...) at /usr/include/g++/bits/shared_ptr_base.h:743
#6  0x00007ca412024d9d in std::__shared_ptr<boost::asio::ssl::detail::openssl_init_base::do_init, (__gnu_cxx::_Lock_policy)2>::__shared_ptr (this=0x7ca412ef9a00 <boost::asio::ssl::detail::openssl_init<true>::instance_>) at /usr/include/g++/bits/shared_ptr_base.h:1186
#7  0x00007ca412024dc7 in std::shared_ptr<boost::asio::ssl::detail::openssl_init_base::do_init>::shared_ptr (this=0x7ca412ef9a00 <boost::asio::ssl::detail::openssl_init<true>::instance_>) at /usr/include/g++/bits/shared_ptr.h:149
#8  0x00007ca412024e77 in boost::asio::ssl::detail::openssl_init_base::instance () at /home/user/test/boost-1.84.0/boost/asio/ssl/detail/impl/openssl_init.ipp:152
#9  0x00007ca412026131 in boost::asio::ssl::detail::openssl_init<true>::openssl_init (this=0x7ca412ef9a00 <boost::asio::ssl::detail::openssl_init<true>::instance_>) at /home/user/test/boost-1.84.0/boost/asio/ssl/detail/openssl_init.hpp:60
#10 0x00007ca411b798f9 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at /home/user/test/boost-1.84.0/boost/asio/ssl/detail/openssl_init.hpp:90
#11 0x00007ca411b79cbc in _GLOBAL__sub_I_converters.cpp(void) () at src/converters.cpp:559
#12 0x00007f7e77606416 in _rtld_call_init_function () from /usr/libexec/ld.elf_so
#13 0x00007f7e7760675c in _rtld_call_init_functions () from /usr/libexec/ld.elf_so
#14 0x00007f7e77607698 in dlopen () from /usr/libexec/ld.elf_so
#15 0x00007ca4155d9e3f in _PyImport_FindSharedFuncptr (prefix=0x7ca415692a17 "PyInit", shortname=shortname@entry=0x7ca414f3ea90 "libtorrent", pathname=pathname@entry=0x7ca414f3fd70 "/home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so", fp=fp@entry=0x0) at ../Python/dynload_shlib.c:96
#16 0x00007ca4155a9157 in _PyImport_LoadDynamicModuleWithSpec (spec=spec@entry=0x7ca414f59920, fp=fp@entry=0x0) at ../Python/importdl.c:129
#17 0x00007ca4155a6c0b in _imp_create_dynamic_impl (module=module@entry=0x7ca41537d8d0, spec=0x7ca414f59920, file=<optimized out>) at ../Python/import.c:2174
#18 0x00007ca4155a6e03 in _imp_create_dynamic (module=module@entry=0x7ca41537d8d0, args=args@entry=0x7ca414ffb6a8, nargs=nargs@entry=1) at ../Python/clinic/import.c.h:289
#19 0x00007ca41548eabe in _PyMethodDef_RawFastCallDict (method=0x7ca415939c60 <imp_methods+320>, self=0x7ca41537d8d0, args=args@entry=0x7ca414ffb6a8, nargs=1, kwargs=0x7ca414fe9060) at ../Objects/call.c:530
#20 0x00007ca41548ecc3 in _PyCFunction_FastCallDict (func=func@entry=0x7ca41531d060, args=args@entry=0x7ca414ffb6a8, nargs=<optimized out>, kwargs=kwargs@entry=0x7ca414fe9060) at ../Objects/call.c:585
#21 0x00007ca41548fe1d in PyCFunction_Call (func=func@entry=0x7ca41531d060, args=args@entry=0x7ca414ffb680, kwargs=kwargs@entry=0x7ca414fe9060) at ../Objects/call.c:789
#22 0x00007ca41557a15b in do_call_core (func=func@entry=0x7ca41531d060, callargs=callargs@entry=0x7ca414ffb680, kwdict=kwdict@entry=0x7ca414fe9060) at ../Python/ceval.c:4641
#23 0x00007ca41558840f in _PyEval_EvalFrameDefault (f=0x7ca414f4e060, throwflag=<optimized out>) at ../Python/ceval.c:3191
#24 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca414f4e060, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#25 0x00007ca41557c464 in _PyEval_EvalCodeWithName (_co=0x7ca4153037c0, globals=<optimized out>, locals=locals@entry=0x0, args=args@entry=0x7ca41599ba60, argcount=2, kwnames=0x0, kwargs=kwargs@entry=0x7ca41599ba70, kwcount=0, kwstep=kwstep@entry=1, defs=defs@entry=0x0, defcount=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=name@entry=0x7ca4153046c0, qualname=0x7ca4153046c0) at ../Python/ceval.c:3930
#26 0x00007ca41548d88d in _PyFunction_FastCallKeywords (func=func@entry=0x7ca41531f360, stack=stack@entry=0x7ca41599ba60, nargs=nargs@entry=2, kwnames=kwnames@entry=0x0) at ../Objects/call.c:433
#27 0x00007ca41557a924 in call_function (pp_stack=pp_stack@entry=0x7f7fffc9c770, oparg=oparg@entry=2, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#28 0x00007ca415587e79 in _PyEval_EvalFrameDefault (f=0x7ca41599b8c0, throwflag=<optimized out>) at ../Python/ceval.c:3093
#29 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca41599b8c0, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#30 0x00007ca41548cc85 in function_code_fastcall (co=<optimized out>, args=0x7ca4153239c0, nargs=nargs@entry=2, globals=<optimized out>) at ../Objects/call.c:283
#31 0x00007ca41548d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7ca4152d88a0, stack=stack@entry=0x7ca4153239b0, nargs=nargs@entry=2, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#32 0x00007ca41557a924 in call_function (pp_stack=pp_stack@entry=0x7f7fffc9c9c0, oparg=oparg@entry=2, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#33 0x00007ca415587da9 in _PyEval_EvalFrameDefault (f=0x7ca415323820, throwflag=<optimized out>) at ../Python/ceval.c:3110
#34 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca415323820, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#35 0x00007ca41548cc85 in function_code_fastcall (co=<optimized out>, args=0x7ca414efe758, nargs=nargs@entry=1, globals=<optimized out>) at ../Objects/call.c:283
#36 0x00007ca41548d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7ca4153212a0, stack=stack@entry=0x7ca414efe750, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#37 0x00007ca41557a924 in call_function (pp_stack=pp_stack@entry=0x7f7fffc9cc18, oparg=oparg@entry=1, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#38 0x00007ca415587ef5 in _PyEval_EvalFrameDefault (f=0x7ca414efe5c0, throwflag=<optimized out>) at ../Python/ceval.c:3124
#39 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca414efe5c0, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#40 0x00007ca41548cc85 in function_code_fastcall (co=<optimized out>, args=0x7ca414efe508, nargs=nargs@entry=1, globals=<optimized out>) at ../Objects/call.c:283
#41 0x00007ca41548d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7ca4153215a0, stack=stack@entry=0x7ca414efe500, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#42 0x00007ca41557a924 in call_function (pp_stack=pp_stack@entry=0x7f7fffc9ce68, oparg=oparg@entry=1, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#43 0x00007ca415587ef5 in _PyEval_EvalFrameDefault (f=0x7ca414efe340, throwflag=<optimized out>) at ../Python/ceval.c:3124
#44 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca414efe340, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#45 0x00007ca41548cc85 in function_code_fastcall (co=<optimized out>, args=0x7ca414efe278, nargs=nargs@entry=2, globals=<optimized out>) at ../Objects/call.c:283
#46 0x00007ca41548d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7ca415325de0, stack=stack@entry=0x7ca414efe268, nargs=nargs@entry=2, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#47 0x00007ca41557a924 in call_function (pp_stack=pp_stack@entry=0x7f7fffc9d0b8, oparg=oparg@entry=2, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#48 0x00007ca415587ef5 in _PyEval_EvalFrameDefault (f=0x7ca414efe0c0, throwflag=<optimized out>) at ../Python/ceval.c:3124
#49 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca414efe0c0, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#50 0x00007ca41548cc85 in function_code_fastcall (co=co@entry=0x7ca415313d00, args=0x7f7fffc9d2f0, args@entry=0x7f7fffc9d2e0, nargs=nargs@entry=2, globals=globals@entry=0x7ca41531aa60) at ../Objects/call.c:283
#51 0x00007ca41548d4a4 in _PyFunction_FastCallDict (func=func@entry=0x7ca415325ea0, args=args@entry=0x7f7fffc9d2e0, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at ../Objects/call.c:322
#52 0x00007ca41548eeec in _PyObject_FastCallDict (callable=callable@entry=0x7ca415325ea0, args=args@entry=0x7f7fffc9d2e0, nargs=nargs@entry=2, kwargs=kwargs@entry=0x0) at ../Objects/call.c:98
#53 0x00007ca41548fb1b in object_vacall (callable=callable@entry=0x7ca415325ea0, vargs=vargs@entry=0x7f7fffc9d348) at ../Objects/call.c:1200
#54 0x00007ca41548fcff in _PyObject_CallMethodIdObjArgs (obj=<optimized out>, name=name@entry=0x7ca4159398e0 <PyId__find_and_load.9>) at ../Objects/call.c:1250
#55 0x00007ca4155a4ad9 in import_find_and_load (abs_name=abs_name@entry=0x7ca414fe2970) at ../Python/import.c:1652
#56 0x00007ca4155a7fba in PyImport_ImportModuleLevelObject (name=name@entry=0x7ca414fe2970, globals=<optimized out>, locals=<optimized out>, fromlist=fromlist@entry=0x7ca415921a40 <_Py_NoneStruct>, level=level@entry=0) at ../Python/import.c:1764
#57 0x00007ca415579399 in import_name (f=f@entry=0x7ca41599b3c0, name=name@entry=0x7ca414fe2970, fromlist=fromlist@entry=0x7ca415921a40 <_Py_NoneStruct>, level=level@entry=0x7ca415970a10 <small_ints+240>) at ../Python/ceval.c:4770
#58 0x00007ca415585ad0 in _PyEval_EvalFrameDefault (f=0x7ca41599b3c0, throwflag=<optimized out>) at ../Python/ceval.c:2600
#59 0x00007ca41557b95b in PyEval_EvalFrameEx (f=f@entry=0x7ca41599b3c0, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#60 0x00007ca41557c464 in _PyEval_EvalCodeWithName (_co=0x7ca414f4c880, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=argcount@entry=0, kwnames=0x0, kwargs=0x0, kwcount=kwcount@entry=0, kwstep=kwstep@entry=2, defs=defs@entry=0x0, defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=name@entry=0x0, qualname=qualname@entry=0x0) at ../Python/ceval.c:3930
#61 0x00007ca41557c62a in PyEval_EvalCodeEx (_co=_co@entry=0x7ca414f4c880, globals=globals@entry=0x7ca415277160, locals=locals@entry=0x7ca415277160, args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at ../Python/ceval.c:3959
#62 0x00007ca41557c67e in PyEval_EvalCode (co=co@entry=0x7ca414f4c880, globals=globals@entry=0x7ca415277160, locals=locals@entry=0x7ca415277160) at ../Python/ceval.c:524
#63 0x00007ca4155be3e1 in run_mod (mod=mod@entry=0x7ca4159ba0a8, filename=filename@entry=0x7ca414fe2740, globals=globals@entry=0x7ca415277160, locals=locals@entry=0x7ca415277160, flags=flags@entry=0x7f7fffc9d8dc, arena=arena@entry=0x7ca415287700) at ../Python/pythonrun.c:1037
#64 0x00007ca4155c083b in PyRun_StringFlags (str=str@entry=0x7ca414fe2700 "import libtorrent\n", start=start@entry=257, globals=0x7ca415277160, locals=0x7ca415277160, flags=flags@entry=0x7f7fffc9d8dc) at ../Python/pythonrun.c:961
#65 0x00007ca4155c08a2 in PyRun_SimpleStringFlags (command=0x7ca414fe2700 "import libtorrent\n", flags=flags@entry=0x7f7fffc9d8dc) at ../Python/pythonrun.c:455
#66 0x00007ca4155de162 in pymain_run_command (command=<optimized out>, cf=cf@entry=0x7f7fffc9d8dc) at ../Modules/main.c:422
#67 0x00007ca4155deda8 in pymain_run_python (pymain=pymain@entry=0x7f7fffc9d920) at ../Modules/main.c:2958
#68 0x00007ca4155e2a81 in pymain_main (pymain=pymain@entry=0x7f7fffc9d920) at ../Modules/main.c:3125
#69 0x00007ca4155e2b07 in _Py_UnixMain (argc=<optimized out>, argv=<optimized out>) at ../Modules/main.c:3160
#70 0x0000000000400b03 in main (argc=<optimized out>, argv=<optimized out>) at ../Programs/python.c:15

Trial #4: crypto=wolfssl

# latest release is 5.7.0 at this time
curl -LO https://github.com/wolfSSL/wolfssl/archive/refs/tags/v5.7.0-stable.tar.gz
tar -xvf v5.7.0-stable.tar.gz
cd wolfssl-5.7.0-stable
./autogen.sh
./configure --enable-sni --enable-asio --enable-nginx --enable-opensslextra --enable-static --enable-debug --prefix=/usr/local/custom
gmake
doas sh -c 'gmake install'  # only doas doesn't work

Install:

cd ../libtorrent-rasterbar-2.0.10
python3.7 setup.py build_ext --b2-args="toolset=gcc-test crypto=wolfssl" install --prefix=~/.local
$ python3.7 -c 'import libtorrent'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /home/user/.local/lib/python3.7/site-packages/libtorrent-0.0.0-py3.7-netbsd-10.0-amd64.egg/libtorrent/__init__.so: Undefined PLT symbol "SSL_CTX_free" (symnum = 15)

Trial #5

This time I tried to test libtorrent 2.0.6, in my expected venv, py 3.7 (debug, built from source with OpenSSL 1.x to see if it fixes anything), with crypto=built-in:

user-config.jam

using python : 3.7 : /usr/local/python37 : /usr/local/python37/include/python3.7dm : /usr/local/python37/lib/python3.7 : <python-debugging>on ;
using gcc : simpletest : g++ : <cxxflags>-std=gnu++14 <cxxflags>-fext-numeric-literals <cxxflags>-fPIC ;
$ realpath $VIRTUAL_ENV/bin/python
/usr/local/python37/bin/python3.7
$ python setup.py build_ext --b2-args="toolset=gcc-simpletest variant=debug boost-link=static libtorrent-link=static crypto=built-in" install
...
...
$ ldd /home/user/Codes/lbry-sdk/lbry-venv/lib/python3.7/site-packages/libtorrent-2.0.6-py3.7-netbsd-10.0-amd64.egg/libtorrent.so 
/home/user/Codes/lbry-sdk/lbry-venv/lib/python3.7/site-packages/libtorrent-2.0.6-py3.7-netbsd-10.0-amd64.egg/libtorrent.so:
	-lpthread.1 => /usr/lib/libpthread.so.1
	-lc.12 => /usr/lib/libc.so.12
	-lutil.7 => /usr/lib/libutil.so.7
	-lstdc++.9 => /usr/lib/libstdc++.so.9
	-lm.0 => /usr/lib/libm.so.0
	-lgcc_s.1 => /usr/lib/libgcc_s.so.1

It got rid of the crash during import. It crashed later instead:

$ python -c 'import libtorrent'  # <- no crash
$ lbrynet start
...
2024-07-04 18:45:53,002 INFO     lbry.extras.daemon.daemon:489: Starting LBRYNet Daemon
2024-07-04 18:45:53,012 INFO     lbry.extras.daemon.daemon:491: Platform: {
  "processor": "x86_64",
  "python_version": "3.7.17",
  "platform": "NetBSD-10.0-amd64-x86_64-64bit-ELF",
  "os_release": "10.0",
  "os_system": "NetBSD",
  "lbrynet_version": "0.113.0",
  "version": "0.113.0",
  "build": "dev"
}
2024-07-04 18:45:53,022 INFO     lbry.extras.daemon.daemon:501: RPC server listening on TCP ::1:5279
2024-07-04 18:45:53,032 INFO     lbry.extras.daemon.daemon:511: media server listening on TCP 127.0.0.1:5280
Abort trap (core dumped)
gdb bt here
$ gdb -q -ex 'set pagination off' -ex 'backtrace' -ex 'quit' `which python3.7` python3.7.core
Reading symbols from /home/user/Codes/lbry-sdk/lbry-venv/bin/python3.7...
[New process 3721]
[New process 16096]
[New process 23388]
[New process 17591]
Core was generated by `python3.7'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007bf43717e74a in _lwp_kill () from /usr/lib/libc.so.12
[Current thread is 1 (process 3721)]
#0  0x00007bf43717e74a in _lwp_kill () from /usr/lib/libc.so.12
#1  0x00007bf437048fa4 in __libc_mutex_unlock_stub () from /usr/lib/libc.so.12
#2  0x00007bf426edce4e in __gthread_active_p () at /usr/include/g++/bits/gthr-posix.h:201
#3  0x00007bf427154f60 in __gnu_cxx::__atomic_add_dispatch (__val=1, __mem=0x7bf42e74e008) at /usr/include/g++/ext/atomicity.h:94
#4  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy (this=0x7bf42e74e000) at /usr/include/g++/bits/shared_ptr_base.h:142
#5  0x00007bf42715480b in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count (this=0x7bf42e751098, __r=...) at /usr/include/g++/bits/shared_ptr_base.h:743
#6  0x00007bf4274245e7 in std::__shared_ptr<libtorrent::plugin, (__gnu_cxx::_Lock_policy)2>::__shared_ptr (this=0x7bf42e751090) at /usr/include/g++/bits/shared_ptr_base.h:1186
#7  0x00007bf427424611 in std::shared_ptr<libtorrent::plugin>::shared_ptr (this=0x7bf42e751090) at /usr/include/g++/bits/shared_ptr.h:149
#8  0x00007bf427424653 in std::_Construct<std::shared_ptr<libtorrent::plugin>, std::shared_ptr<libtorrent::plugin> const&> (__p=0x7bf42e751090) at /usr/include/g++/bits/stl_construct.h:109
#9  0x00007bf42742452b in std::__uninitialized_copy<false>::__uninit_copy<std::shared_ptr<libtorrent::plugin> const*, std::shared_ptr<libtorrent::plugin>*> (__first=0x7bf424ffe8d0, __last=0x7bf424ffe900, __result=0x7bf42e751090) at /usr/include/g++/bits/stl_uninitialized.h:91
#10 0x00007bf4274237cc in std::uninitialized_copy<std::shared_ptr<libtorrent::plugin> const*, std::shared_ptr<libtorrent::plugin>*> (__first=0x7bf424ffe8d0, __last=0x7bf424ffe900, __result=0x7bf42e751090) at /usr/include/g++/bits/stl_uninitialized.h:150
#11 0x00007bf427422665 in std::__uninitialized_copy_a<std::shared_ptr<libtorrent::plugin> const*, std::shared_ptr<libtorrent::plugin>*, std::shared_ptr<libtorrent::plugin> > (__first=0x7bf424ffe8d0, __last=0x7bf424ffe900, __result=0x7bf42e751090) at /usr/include/g++/bits/stl_uninitialized.h:325
#12 0x00007bf4274214a8 in std::vector<std::shared_ptr<libtorrent::plugin>, std::allocator<std::shared_ptr<libtorrent::plugin> > >::_M_range_initialize<std::shared_ptr<libtorrent::plugin> const*> (this=0x7bf424ffe980, __first=0x7bf424ffe8d0, __last=0x7bf424ffe900) at /usr/include/g++/bits/stl_vector.h:1585
#13 0x00007bf427420163 in std::vector<std::shared_ptr<libtorrent::plugin>, std::allocator<std::shared_ptr<libtorrent::plugin> > >::vector (this=0x7bf424ffe980, __l=..., __a=...) at /usr/include/g++/bits/stl_vector.h:629
#14 0x00007bf426f6b828 in libtorrent::(anonymous namespace)::default_plugins (empty=false) at ../../src/session_params.cpp:55
#15 0x00007bf426f6b92a in libtorrent::session_params::session_params (this=0x7bf424ffe9e0, sp=...) at ../../src/session_params.cpp:67
#16 0x00007bf426ee805a in (anonymous namespace)::make_session (sett=..., flags=...) at src/session.cpp:201
#17 0x00007bf42722e8b1 in boost::python::detail::invoke<boost::python::detail::install_holder<std::shared_ptr<libtorrent::session> >, std::shared_ptr<libtorrent::session> (*)(boost::python::dict, libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>), boost::python::arg_from_python<boost::python::dict>, boost::python::arg_from_python<libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void> > > (rc=..., f=@0x7bf42f6130d8: 0x7bf426ee7fc3 <(anonymous namespace)::make_session(boost::python::dict, libtorrent::session_flags_t)>, ac0=..., ac1=...) at /home/user/Codes/boost-1.84.0/boost/python/detail/invoke.hpp:73
#18 0x00007bf42721cd4c in boost::python::detail::caller_arity<2u>::impl<std::shared_ptr<libtorrent::session> (*)(boost::python::dict, libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>), boost::python::detail::constructor_policy<boost::python::default_call_policies>, boost::mpl::vector3<std::shared_ptr<libtorrent::session>, boost::python::dict, libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void> > >::operator() (this=0x7bf42f6130d8, args_=0x7bf42e7a3b60) at /home/user/Codes/boost-1.84.0/boost/python/detail/caller.hpp:233
#19 0x00007bf42720e8c1 in boost::python::objects::signature_py_function_impl<boost::python::detail::caller<std::shared_ptr<libtorrent::session> (*)(boost::python::dict, libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void>), boost::python::detail::constructor_policy<boost::python::default_call_policies>, boost::mpl::vector3<std::shared_ptr<libtorrent::session>, boost::python::dict, libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void> > >, boost::mpl::v_item<void, boost::mpl::v_item<boost::python::api::object, boost::mpl::v_mask<boost::mpl::vector3<std::shared_ptr<libtorrent::session>, boost::python::dict, libtorrent::flags::bitfield_flag<unsigned char, libtorrent::session_flags_tag, void> >, 1>, 1>, 1> >::operator() (this=0x7bf42f6130d0, args=0x7bf42e7a3b60, kw=0x7bf42e7a8260) at /home/user/Codes/boost-1.84.0/boost/python/object/py_function.hpp:64
#20 0x00007bf4273ae53d in boost::python::objects::py_function::operator() (this=0x7bf42ee1cf20, args=0x7bf42e7a3b60, kw=0x7bf42e7a8260) at /home/user/Codes/boost-1.84.0/boost/python/object/py_function.hpp:147
#21 0x00007bf426f19959 in boost::python::objects::function::call (this=0x7bf42ee1cf60, args=0x7bf42eab6260, keywords=0x7bf42e7a8260) at /home/user/Codes/boost-1.84.0/libs/python/src/object/function.cpp:221
#22 0x00007bf426f1aee9 in boost::python::objects::(anonymous namespace)::bind_return::operator() (this=0x7bf424ffefb0) at /home/user/Codes/boost-1.84.0/libs/python/src/object/function.cpp:581
#23 0x00007bf426f1b91c in boost::detail::function::void_function_ref_invoker0<boost::python::objects::(anonymous namespace)::bind_return, void>::invoke (function_obj_ptr=...) at /home/user/Codes/boost-1.84.0/boost/function/function_template.hpp:193
#24 0x00007bf4273b92ae in boost::function0<void>::operator() (this=0x7bf424ffef60) at /home/user/Codes/boost-1.84.0/boost/function/function_template.hpp:771
#25 0x00007bf426f273b2 in boost::python::handle_exception_impl (f=...) at /home/user/Codes/boost-1.84.0/libs/python/src/errors.cpp:25
#26 0x00007bf426f1b5ae in boost::python::handle_exception<boost::python::objects::(anonymous namespace)::bind_return> (f=...) at /home/user/Codes/boost-1.84.0/boost/python/errors.hpp:29
#27 0x00007bf426f1affd in boost::python::objects::function_call (func=0x7bf42ee1cf60, args=0x7bf42eab6260, kw=0x7bf42e7a8260) at /home/user/Codes/boost-1.84.0/libs/python/src/object/function.cpp:622
#28 0x00007bf438a8edb6 in _PyObject_FastCallDict (callable=callable@entry=0x7bf42ee1cf60, args=args@entry=0x7bf424fff090, nargs=nargs@entry=2, kwargs=kwargs@entry=0x7bf42e7a8260) at ../Objects/call.c:125
#29 0x00007bf438a8f124 in _PyObject_Call_Prepend (callable=0x7bf42ee1cf60, obj=obj@entry=0x7bf42e7a99e0, args=0x7bf4340605a0, kwargs=0x7bf42e7a8260) at ../Objects/call.c:906
#30 0x00007bf438a90c77 in method_call (method=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at ../Objects/classobject.c:309
#31 0x00007bf438a8fef8 in PyObject_Call (callable=callable@entry=0x7bf42f24b460, args=args@entry=0x7bf4340605a0, kwargs=kwargs@entry=0x7bf42e7a8260) at ../Objects/call.c:245
#32 0x00007bf438af7070 in slot_tp_init (self=0x7bf42e7a99e0, args=0x7bf4340605a0, kwds=0x7bf42e7a8260) at ../Objects/typeobject.c:6639
#33 0x00007bf438af4473 in type_call (type=<optimized out>, args=0x7bf4340605a0, kwds=0x7bf42e7a8260) at ../Objects/typeobject.c:971
#34 0x00007bf438a8fef8 in PyObject_Call (callable=callable@entry=0x7bf42ee1a040, args=args@entry=0x7bf4340605a0, kwargs=kwargs@entry=0x7bf42e7a8260) at ../Objects/call.c:245
#35 0x00007bf438b7a035 in do_call_core (func=func@entry=0x7bf42ee1a040, callargs=callargs@entry=0x7bf4340605a0, kwdict=kwdict@entry=0x7bf42e7a8260) at ../Python/ceval.c:4645
#36 0x00007bf438b8840f in _PyEval_EvalFrameDefault (f=0x7bf42ea2fa40, throwflag=<optimized out>) at ../Python/ceval.c:3191
#37 0x00007bf438b7b95b in PyEval_EvalFrameEx (f=f@entry=0x7bf42ea2fa40, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#38 0x00007bf438a8cc85 in function_code_fastcall (co=<optimized out>, args=0x7bf42e7546f8, nargs=nargs@entry=1, globals=<optimized out>) at ../Objects/call.c:283
#39 0x00007bf438a8d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7bf430275ba0, stack=stack@entry=0x7bf42e7546f0, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#40 0x00007bf438b7a924 in call_function (pp_stack=pp_stack@entry=0x7bf424fff530, oparg=oparg@entry=1, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#41 0x00007bf438b87da9 in _PyEval_EvalFrameDefault (f=0x7bf42e754540, throwflag=<optimized out>) at ../Python/ceval.c:3110
#42 0x00007bf438b7b95b in PyEval_EvalFrameEx (f=f@entry=0x7bf42e754540, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#43 0x00007bf438a8cc85 in function_code_fastcall (co=co@entry=0x7bf430259640, args=0x7bf43404e138, args@entry=0x7bf43404e118, nargs=nargs@entry=4, globals=globals@entry=0x7bf4302cf560) at ../Objects/call.c:283
#44 0x00007bf438a8d4a4 in _PyFunction_FastCallDict (func=func@entry=0x7bf430275a20, args=args@entry=0x7bf43404e118, nargs=4, kwargs=kwargs@entry=0x7bf42e7b5f60) at ../Objects/call.c:322
#45 0x00007bf438a8ffc3 in PyObject_Call (callable=callable@entry=0x7bf430275a20, args=args@entry=0x7bf43404e0f0, kwargs=kwargs@entry=0x7bf42e7b5f60) at ../Objects/call.c:226
#46 0x00007bf438b7a035 in do_call_core (func=func@entry=0x7bf430275a20, callargs=callargs@entry=0x7bf43404e0f0, kwdict=kwdict@entry=0x7bf42e7b5f60) at ../Python/ceval.c:4645
#47 0x00007bf438b8840f in _PyEval_EvalFrameDefault (f=0x7bf42e7b8660, throwflag=<optimized out>) at ../Python/ceval.c:3191
#48 0x00007bf438b7b95b in PyEval_EvalFrameEx (f=f@entry=0x7bf42e7b8660, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#49 0x00007bf438a8cc85 in function_code_fastcall (co=<optimized out>, args=0x7bf42e7541e8, nargs=nargs@entry=1, globals=<optimized out>) at ../Objects/call.c:283
#50 0x00007bf438a8d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7bf437df5ba0, stack=stack@entry=0x7bf42e7541e0, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#51 0x00007bf438b7a924 in call_function (pp_stack=pp_stack@entry=0x7bf424fffa40, oparg=oparg@entry=1, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#52 0x00007bf438b87da9 in _PyEval_EvalFrameDefault (f=0x7bf42e754040, throwflag=<optimized out>) at ../Python/ceval.c:3110
#53 0x00007bf438b7b95b in PyEval_EvalFrameEx (f=f@entry=0x7bf42e754040, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#54 0x00007bf438a8cc85 in function_code_fastcall (co=<optimized out>, args=0x7bf42e7b85f0, nargs=nargs@entry=1, globals=<optimized out>) at ../Objects/call.c:283
#55 0x00007bf438a8d7f5 in _PyFunction_FastCallKeywords (func=func@entry=0x7bf437df5ea0, stack=stack@entry=0x7bf42e7b85e8, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0) at ../Objects/call.c:408
#56 0x00007bf438b7a924 in call_function (pp_stack=pp_stack@entry=0x7bf424fffc90, oparg=oparg@entry=1, kwnames=kwnames@entry=0x0) at ../Python/ceval.c:4616
#57 0x00007bf438b87da9 in _PyEval_EvalFrameDefault (f=0x7bf42e7b8460, throwflag=<optimized out>) at ../Python/ceval.c:3110
#58 0x00007bf438b7b95b in PyEval_EvalFrameEx (f=f@entry=0x7bf42e7b8460, throwflag=throwflag@entry=0) at ../Python/ceval.c:547
#59 0x00007bf438a8cc85 in function_code_fastcall (co=co@entry=0x7bf43805ee80, args=0x7bf424fffeb8, args@entry=0x7bf424fffeb0, nargs=nargs@entry=1, globals=globals@entry=0x7bf438044d60) at ../Objects/call.c:283
#60 0x00007bf438a8d4a4 in _PyFunction_FastCallDict (func=func@entry=0x7bf437df5c60, args=args@entry=0x7bf424fffeb0, nargs=nargs@entry=1, kwargs=kwargs@entry=0x0) at ../Objects/call.c:322
#61 0x00007bf438a8eeec in _PyObject_FastCallDict (callable=callable@entry=0x7bf437df5c60, args=args@entry=0x7bf424fffeb0, nargs=nargs@entry=1, kwargs=kwargs@entry=0x0) at ../Objects/call.c:98
#62 0x00007bf438a8f124 in _PyObject_Call_Prepend (callable=0x7bf437df5c60, obj=obj@entry=0x7bf42e7a9300, args=0x7bf4390c1060, kwargs=0x0) at ../Objects/call.c:906
#63 0x00007bf438a90c77 in method_call (method=<optimized out>, args=<optimized out>, kwargs=<optimized out>) at ../Objects/classobject.c:309
#64 0x00007bf438a8fef8 in PyObject_Call (callable=0x7bf42f24b4e0, args=0x7bf4390c1060, kwargs=0x0) at ../Objects/call.c:245
#65 0x00007bf438c204b6 in t_bootstrap (boot_raw=boot_raw@entry=0x7bf42e79cb80) at ../Modules/_threadmodule.c:994
#66 0x00007bf438bcdf90 in pythread_wrapper (arg=<optimized out>) at ../Python/thread_pthread.h:174
#67 0x00007bf437e0c89f in pthread.create_tramp () from /usr/lib/libpthread.so.1
#68 0x00007bf437092f80 in ?? () from /usr/lib/libc.so.12
#69 0x0000000000200000 in ?? ()
#70 0x0000000000000000 in ?? ()

Another thing I thought I'd add is when import was failing I saved the output below from venv (don't remember how I built that copy though):

$ PYTHONFAULTHANDLER=1 python -c 'import libtorrent'
Fatal Python error: Aborted

Current thread 0x00007913763f5800 (most recent call first):
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1043 in create_module
  File "<frozen importlib._bootstrap>", line 583 in module_from_spec
  File "<frozen importlib._bootstrap>", line 670 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 983 in _find_and_load
  File "<string>", line 1 in <module>
Abort trap (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant