arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation

Home Page:http://libtorrent.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libtorrent-rasterbar.so got segment fault when starting it

Brubbish opened this issue · comments

Please provide the following information

libtorrent version (or branch): branch RC_2_0

platform/architecture: Ubuntu20.04, amd64 on a wsl2

compiler and compiler version: gcc 11.4.0

please describe what symptom you see, what you would expect to see instead and
how to reproduce it.
I compiled libtorrent strictly follow the steps in https://libtorrent.org/building.html#building-with-cmake, which i cmake then ninja
My cmake command is like: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=14 -Dbuild_tests=ON -G Ninja ..
after built by ninja, I got some libtorrent-rasterbar.so files, but they cannot run properly. Here is the gdb page, it seems that it stops at very beginning.

(No debugging symbols found in ./libtorrent-rasterbar.so)
(gdb) r
Starting program: /home/fuzz-test/libtorrent/build/libtorrent-rasterbar.so

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff78e5000 in ?? ()
(gdb) info reg
rax            0x0                 0
rbx            0x0                 0
rcx            0x0                 0
rdx            0x0                 0
rsi            0x0                 0
rdi            0x0                 0
rbp            0x0                 0x0
rsp            0x7fffffffe370      0x7fffffffe370
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x0                 0
r12            0x0                 0
r13            0x0                 0
r14            0x0                 0
r15            0x0                 0
rip            0x7ffff78e5000      0x7ffff78e5000
eflags         0x10202             [ IF RF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0

But all the tests can be passed.
I am confused about how to use this executable file properly

the best way to ensure you're building libtorrent in an ABI compatible way to work in your program is to point to it as a dependency within CMake itself. I believe that will make cmake use the same build configurations for your executable as the libtorrent library