jash-kothari-forks / libtorrent

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

Core dumped on armv5tel 2.6.31.8 #484

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. configure && make && make install
2. run python, then import libtorrent
3. error appears

What is the expected output? What do you see instead?
expected output is succesfull import in python. 
Instead:
>>> import libtorrent
Aborted (core dumped)

What version of the product are you using? On what operating system?
0.16.10 
armv5tel GNU/Linux
Linux version 2.6.31.8 (root@Neo) (gcc version 4.3.2 (sdk3.3-ct-ng-1.4.1) ) 
with: uClib 0.9.33
libiconv 1.14

Please provide any additional information below.
one modification made to src because of epoll error - added to src:
#include <sys/syscall.h>
#include <sys/epoll.h>

extern "C" {
#ifdef __NR_epoll_create1
_syscall1(int, epoll_create1, int, flags)
#else
int epoll_create1(int flags)
{
    return ENOSYS;
}
#endif
}

Please write if additional info is needed

Original issue reported on code.google.com by mic...@janiszewski.org on 26 May 2013 at 10:38

GoogleCodeExporter commented 8 years ago
would you mind trying to configure with --enable-debug
and then run python under gdb to catch the crash (run "bt full" in gdb after 
it's crashed).
Please post the output from that on this ticket.

Original comment by arvid.no...@gmail.com on 26 May 2013 at 2:05

GoogleCodeExporter commented 8 years ago
Will do that, however I tried using gdb with python and 'import libtorrent' 
comand and failed due to lack of experience with this tool. I'll need some 
guidance with it. Can you please write exactly what should I do after 
compilation ? 

Original comment by mic...@janiszewski.org on 26 May 2013 at 2:44

GoogleCodeExporter commented 8 years ago
tried to compile with --enable-debug however it seems that uClibc does not 
support execinfo.h:

make[1]: Entering directory 
`/e-data/5efc6166-e726-d95b-2f19-db05661a286d/ffproot/ffp/home/admin/libtorrent-
rasterbar-0.16.10/src'
  CXX      web_connection_base.lo
  CXX      alert.lo
  CXX      allocator.lo
  CXX      asio.lo
  CXX      assert.lo
assert.cpp:115:22: fatal error: execinfo.h: No such file or directory
compilation terminated.
make[1]: *** [assert.lo] Error 1
make[1]: Leaving directory 
`/e-data/5efc6166-e726-d95b-2f19-db05661a286d/ffproot/ffp/home/admin/libtorrent-
rasterbar-0.16.10/src'
make: *** [all-recursive] Error 1

how should I proceed?

Original comment by mic...@janiszewski.org on 26 May 2013 at 3:03

GoogleCodeExporter commented 8 years ago
just out of curiosity Ive ran gdb with libtorrent disabled debug - I was not 
able to do bt full:

GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv5tel-unknown-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) python
>import libtorrent
>end
Aborted (core dumped)

Original comment by mic...@janiszewski.org on 26 May 2013 at 4:50

GoogleCodeExporter commented 8 years ago
I also did a strace on python loading libtorrent module. The result is here:
https://hive.waw.pl/stuff/libtorrent-strace.log

Original comment by mic...@janiszewski.org on 26 May 2013 at 7:01

GoogleCodeExporter commented 8 years ago
I'll fix the build error. I take it this is arm-linux? my configuration header 
may assume that all linux platforms have execinfo.h, I'll fix that.

To run under gdb, do this:

$gdb python

If you need to pass in arguments to python:

$gdb --args python <arguments to python>

at the gdb prompt, type "run" and press enter.

Original comment by arvid.no...@gmail.com on 26 May 2013 at 9:24

GoogleCodeExporter commented 8 years ago
Yes, this is an arm linux. Zyxel NSA310 with FFP 0.7 add-on. 
So as soon as execinfo.h will be fixed I'll make a build with debug. 
Thanx.
Rgds,
MJ

Original comment by mic...@janiszewski.org on 26 May 2013 at 9:31

GoogleCodeExporter commented 8 years ago
I just checked this patch in which hopefully fixes the build issue with 
execinfo.h.

Index: src/assert.cpp
===================================================================
--- src/assert.cpp  (revision 8428)
+++ src/assert.cpp  (revision 8429)
@@ -110,8 +110,7 @@
 #include <signal.h>
 #include "libtorrent/version.hpp"

-// execinfo.h is available in the MacOS X 10.5 SDK.
-#if (defined __linux__ || (defined __APPLE__ && MAC_OS_X_VERSION_MIN_REQUIRED 
>= 1050))
+#if TORRENT_USE_EXECINFO
 #include <execinfo.h>

 void print_backtrace(char* out, int len, int max_depth)
Index: include/libtorrent/config.hpp
===================================================================
--- include/libtorrent/config.hpp   (revision 8428)
+++ include/libtorrent/config.hpp   (revision 8429)
@@ -181,6 +181,8 @@
 #define TORRENT_USE_ICONV 0
 #define TORRENT_USE_LOCALE 0
 #define TORRENT_CLOSE_MAY_BLOCK 1
+// execinfo.h is available in the MacOS X 10.5 SDK.
+#define TORRENT_USE_EXECINFO MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
 #endif
 #else
 // FreeBSD has a reasonable iconv signature
@@ -200,6 +202,9 @@
 #define TORRENT_USE_IFCONF 1
 #define TORRENT_HAS_SALEN 0
 #define TORRENT_USE_POSIX_MEMALIGN 1
+#if __amd64__ || __i386__
+#define TORRENT_USE_EXECINFO 1
+#endif

 // ==== MINGW ===
 #elif defined __MINGW32__
@@ -339,6 +344,10 @@
 #define TORRENT_USE_NETLINK 0
 #endif

+#ifndef TORRENT_USE_EXECINFO
+#define TORRENT_USE_EXECINFO 0
+#endif
+
 #ifndef TORRENT_USE_SYSCTL
 #define TORRENT_USE_SYSCTL 0
 #endif

Original comment by arvid.no...@gmail.com on 26 May 2013 at 9:35

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hello, build was succesfull, had some problems running gdb but here is the 
output, I think this is what we need:

root@thehive:/ffp/home/admin# gdb --args python
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv5tel-unknown-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from 
/e-data/5efc6166-e726-d95b-2f19-db05661a286d/ffproot/ffp/bin/python...(no 
debugging symbols found)...done.
(gdb) run
Starting program: 
/e-data/5efc6166-e726-d95b-2f19-db05661a286d/ffproot/ffp/bin/python
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/ffp/lib/libthread_db.so.1".
Python 2.5.6 (r256:88840, Jan 29 2012, 21:53:45)
[GCC 4.5.4 20111110 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
warning: File 
"/e-data/5efc6166-e726-d95b-2f19-db05661a286d/ffproot/ffp/lib/libstdc++.so.6.0.1
6-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to 
"$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /e-data/5efc6166-e726-d95b-2f19-db05661a286d/ffproot/ffp/lib/libstdc++.so.6.0.16-gdb.py
line to your configuration file "/ffp/home/root/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/ffp/home/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"

Program received signal SIGILL, Illegal instruction.
0x40a6fde0 in _armv7_neon_probe () from /ffp/lib/libcrypto.so.1.0.0
(gdb) bt full
#0  0x40a6fde0 in _armv7_neon_probe () from /ffp/lib/libcrypto.so.1.0.0
No symbol table info available.
#1  0x40a6fd84 in OPENSSL_cpuid_setup () from /ffp/lib/libcrypto.so.1.0.0
No symbol table info available.
#2  0x40000f18 in ?? () from /ffp/lib/ld-uClibc.so.0
No symbol table info available.
#3  0x40000f18 in ?? () from /ffp/lib/ld-uClibc.so.0
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

Original comment by mic...@janiszewski.org on 27 May 2013 at 6:14

GoogleCodeExporter commented 8 years ago
Update: don't know if its significant but after exporting OPENSSL_armcap=5 
variable there is a change in gdb trace. The trace is in attachement.

Original comment by mic...@janiszewski.org on 27 May 2013 at 4:47

Attachments:

GoogleCodeExporter commented 8 years ago
you might want to try to disable openssl entirely, to see if that works.

./configure --disable-encryption

Original comment by arvid.no...@gmail.com on 27 May 2013 at 8:56

GoogleCodeExporter commented 8 years ago
will do, started configure && make with these parameters:
./configure --disable-encryption --with-boost-libdir=/ffp/lib --enable-debug 
--with-libgeoip --prefix=/ffp --enable-python-bindin     g --with-boost-python 
--with-libiconv CPPFLAGS=-DBOOST_FILESYSTEM_VERSION=2 
CFLAGS=-DBOOST_FILESYSTEM_VERSION=2

Original comment by mic...@janiszewski.org on 27 May 2013 at 10:08

GoogleCodeExporter commented 8 years ago
output of GDB using version without openssl is the same as with previous 
version (with openssl) and exported OPENSSL_armcap=5 variable:

>>> import libtorrent

Program received signal SIGABRT, Aborted.
0x401f9924 in raise () from /ffp/lib/libc.so.0
(gdb) bt full
#0  0x401f9924 in raise () from /ffp/lib/libc.so.0
No symbol table info available.
#1  0x401f3750 in abort () from /ffp/lib/libc.so.0
No symbol table info available.
#2  0x40a435ec in unwind_phase2 () from /ffp/lib/libgcc_s.so.1
No symbol table info available.
#3  0x40a44038 in __gnu_Unwind_Resume () from /ffp/lib/libgcc_s.so.1
No symbol table info available.
#4  0x40a44294 in ___Unwind_Resume () from /ffp/lib/libgcc_s.so.1
No symbol table info available.
#5  0x40230b48 in ?? ()
Cannot access memory at address 0x0
No symbol table info available.
#6  0x40230b48 in ?? ()
Cannot access memory at address 0x0
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Original comment by mic...@janiszewski.org on 28 May 2013 at 6:58

GoogleCodeExporter commented 8 years ago
Hello,
I've changed the approach and decided to build libtorrent with Boost:Build, 
static links and minimal functionality.
Ive ran build process with 
 b2 boost=source boost-link=static asserts=on geoip=off encryption=off link=static runtime-link=static debug-symbols=on iconv=off toolset=gcc
from libtorrent main directory, it passed without errors.
Then I used the same command in bindings/python/ directory. At the end of build 
process it shown errors (in attachement). Please help as I'm kind of stuck 
Please see attached log.

Original comment by mic...@janiszewski.org on 31 May 2013 at 7:56

Attachments:

GoogleCodeExporter commented 8 years ago
perhaps uclibc doesn't like to be linked against statically, maybe not when 
you're building a shared library.

You could try to not pass in "runtime-link=static"

Original comment by arvid.no...@gmail.com on 31 May 2013 at 8:46

GoogleCodeExporter commented 8 years ago
you were right - compilation runs ok without "runtime-link=static". I'm stuck 
with another thing. I can install libtorrent base without problems (b2 install 
.....) but when I invoke the command from bindings/python/ directory i get 
following error:

:/ffp/home/admin/libtorrent-rasterbar-0.16.10/bindings/python# b2 install 
boost=source boost-link=static asserts=on geoip=off encryption=off link=static 
debug-symbols=on iconv=off toolset=gcc 
--prefix=/mnt/HD_a2/build/libtorrent-rasterbar/ffp
BOOST_ROOT = /ffp/home/admin/boost_1_53_0
CXXFLAGS = -I/ffp/include
LDFLAGS = -L/ffp/lib
OS = LINUX
notice: could not find main target install
notice: assuming it is a name of file to create.
don't know how to make <e>install
...found 1 target...
...can't find 1 target...

Original comment by mic...@janiszewski.org on 31 May 2013 at 1:40

GoogleCodeExporter commented 8 years ago
There is no install rule for the python bindings. There is a fairly hacky 
setup.py that's currently used to install python (or to build installers at 
least). I'm not all that familiar with installing python modules unfortunately.

If you'd like to patch the Jamfile to install python bindings, I'd be happy to 
merge that in.

Original comment by arvid.no...@gmail.com on 31 May 2013 at 4:48

GoogleCodeExporter commented 8 years ago
I'll think about it. In the mean time I wanted to run examples (since base 
libtorrent is built)
./client_test base.torrent

results: 
[q] quit [i] toggle peers [d] toggle downloading pieces [p] toggle paused [a] 
toggle piece bar [s] toggle download sequential [f] toggle files [m] add 
magnet[j] force recheck [space] toggle session pause [c] clear error [v] scrape 
[g] show DHT
[1] toggle IP [2] toggle AS [3] toggle timers [4] toggle block progress [5] 
toggle peer rate [6] toggle failures [7] toggle send buffers [R] save resume 
data
[all (1)][downloading (0)][non-paused (0)][seeding (0)][queued (1)][stopped 
(0)][checking (0)][RSS (0)]
==== conns: 0 down:          (      ) up:          (      ) tcp/ip:             
      DHT:                   tracker:                   ====
==== waste:        fail:        unchoked: 0 / 8 bw queues:        0 (0) |       
 0 (0) disk queues: 0 | 0 cache: w: 100% r: 0% size:        (      ) /        
dq: 0 ===
==== optimistic unchoke: 29 unchoke counter: -2 peerlist: 0 ====

assertion failed. Please file a bugreport at 
http://code.google.com/p/libtorrent/issues
Please include the following information:

version: 0.16.10.0
$Rev: 8403 $
file: 'src/udp_socket.cpp'
line: 185
function: void libtorrent::udp_socket::send(const endpoint&, const char*, int, 
boost::system::error_code&, int)
expression: is_open()

stack:

Should I do another ticket for that with GDB dump ? 

Original comment by mic...@janiszewski.org on 31 May 2013 at 4:53

GoogleCodeExporter commented 8 years ago
please do. please include gdb stack trace as well (since libtorrent can't 
produce those on arm-linux). preferably "bt full".

My guess is that the udp socket fails to open for some reason. Could it be that 
your system doesn't support IPv6 for instance? If so you may want to disable 
that in the build as well (but obviously it should be handled gracefully at 
runtime as well).

Original comment by arvid.no...@gmail.com on 31 May 2013 at 5:39

GoogleCodeExporter commented 8 years ago
as for bindings build process - my primary goal for now is to build a working 
libtorrent package that works for the NSA devices and add it to the FFP 0.7 
repository for further use. secondary goal is to build a client based on 
libtorrent that utilizes functionality of proxying with good webui - candidated 
are Deluge (which requires bindings )and qbitorrent (which requires qt4 library 
which currently I do not  have for NSA devices). So for adding install  rule 
I'm afraid I do not posess proper knowledge to do that (will try though when I 
understand how to register library in python and have some additional spare 
time)

Original comment by mic...@janiszewski.org on 1 Jun 2013 at 12:36

GoogleCodeExporter commented 8 years ago
is this ticket still relevant?

Original comment by arvid.no...@gmail.com on 9 Jun 2013 at 6:09

GoogleCodeExporter commented 8 years ago
This ticket concerned version built without bjam. The error that was a problem 
here was a core dump while importing libtorrent in python - I guess there is 
possibility that cxxflags=-DBOOST_ASIO_DISABLE_EPOLL described in 485 wil fix 
this also. Lets close it for now.
Thank you.

Original comment by mic...@janiszewski.org on 9 Jun 2013 at 9:14

GoogleCodeExporter commented 8 years ago
one thing though : can you give a hint how to build python bindings with bjam  ?

Original comment by mic...@janiszewski.org on 9 Jun 2013 at 9:23

GoogleCodeExporter commented 8 years ago
This is how I build them on windows:

   bjam boost=source link=static geoip=static boost-link=static release msvc-9.0 optimization=space

you may want to remove msvc-9.0 and for debug builds remove "release" and 
"optimization=space".

Invoke bjam in the bindings/python directory.

Original comment by arvid.no...@gmail.com on 9 Jun 2013 at 3:21

GoogleCodeExporter commented 8 years ago
thanks. I did this with the same command that build libtorrent and it worked. 
My problem is, after building, how to register the builded files with python to 
make pyton see the libraries

Original comment by mic...@janiszewski.org on 9 Jun 2013 at 3:30

GoogleCodeExporter commented 8 years ago
I believe you can just put libtorrent.so in cwd when running python.

Original comment by arvid.no...@gmail.com on 9 Jun 2013 at 4:02

GoogleCodeExporter commented 8 years ago
I copied libtorrent.so to site-packages directory however while running 'import 
libtorrent' in python there is some dlopen() error

Original comment by mic...@janiszewski.org on 10 Jun 2013 at 4:36