MLDonkey Forum Index
Homepage •  Bugs •  Tasks •  Patches •  SF.net Project Page •  ChangeLog •  German forum •  Links •  Wiki •  Downloads
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Run mlnet on RTL8198(mips) platform

 
Post new topic   Reply to topic    MLDonkey Forum Index -> Alternative platforms
View previous topic :: View next topic  
Author Message
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Thu Jun 07, 2012 10:42 am    Post subject: Run mlnet on RTL8198(mips) platform Reply with quote

Hi friends,
I'm trying to run mlnet in Realtek 8198 CPU, but met this problem.Any suggestion will be appreciated.
I used QEMU to simulate a mips mechine "debian_squeeze_mips_standard", the compiling is successful and "mlnet.byte.static" works in the virtual mechine at least.
Then I copy the "mlnet.byte.static" to my router(RTL8198), and it got Segmentation fault at the beginning.. Did I miss something? Anyone met the same situation before?
Thanks.
------------------RTL8198-----------------------

# ./mlnet.byte.static
Segmentation fault
#
------------------Debian Virtual mechine-------------------
root@debian-mips:/home/jeff/mldonkey-3.0.1# ./mlnet.byte.static
2012/06/07 10:32:05 [cO] Starting MLDonkey 3.0.1 ...
2012/06/07 10:32:05 [cO] Language EN, locale UTF-8, ulimit for open files 1024
2012/06/07 10:32:05 [cO] MLDonkey is working in /root/.mldonkey
2012/06/07 10:32:05 [Gettext] Loading language resource mlnet_strings.en_US.UTF-8
2012/06/07 10:32:06 [cO] loaded language resource file
2012/06/07 10:32:06 [DNS] Resolving [debian-mips] ...
2012/06/07 10:32:06 [DNS] Resolving [www.mldonkey.org] ...
2012/06/07 10:32:06 [dMain] Libmagic file-type recognition database present
2012/06/07 10:32:06 [cO] Logging in /root/.mldonkey/mlnet.log
2012/06/07 10:32:07 [dMain] Core started
Back to top
View user's profile Send private message
ygrek
professional


Joined: 20 Mar 2010
Posts: 610

PostPosted: Thu Jun 07, 2012 2:42 pm    Post subject: Reply with quote

We need more info. Can you get the backtrace from the debugger?
Can you run a small ocaml program on that cpu - e.g. create test.ml in qemu with code :
Code:
let () = print_endline "test ok"

and compile with
Code:
ocamlc -custom test.ml -o test

and check whether it works on the router.
_________________
Download | Report bugs | git mirror
Back to top
View user's profile Send private message Visit poster's website
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Fri Jun 08, 2012 2:31 am    Post subject: Reply with quote

ygrek wrote:
We need more info. Can you get the backtrace from the debugger?
Can you run a small ocaml program on that cpu - e.g. create test.ml in qemu with code :
Code:
let () = print_endline "test ok"

and compile with
Code:
ocamlc -custom test.ml -o test

and check whether it works on the router.


Thanks for the reply.
It seems my router can NOT run ocaml program directly, anything need to be added?
------------------Debian Virtual mechine---------------
root@debian-mips:/home/jeff# ./test
test OK.
------------------RTL8198--------------------------------
# ls -l
-rw-r--r-- 1 root root 1 Jun 7 11:39 brs_gui_hijack
-rw-r--r-- 1 root root 1 Jun 7 11:39 brs_hijack.out
drwxrwxrwx 10 root root 0 Jun 8 05:19 etc
-rw-r--r-- 1 root root 0 Jun 7 11:39 fw_check_done
-r--r--r-- 1 root root 18 Jun 8 05:19 lan_uptime
drwxr-xr-x 3 root root 0 Jan 1 1970 language
-rw-r--r-- 1 root root 17 Jan 1 1970 mac
drwxrwxrwx 3 root root 0 Jan 1 1970 mnt
-rw-r--r-- 1 root root 1 Jan 1 1970 ntp_start
-rw------- 1 root root 8937 Jun 7 11:40 nvram
-rw------- 1 root root 98 Jan 1 1970 nvram.bcm
-rw-r--r-- 1 root root 124 Jan 1 1970 option
-rw-r--r-- 1 root root 7833 Jun 7 11:39 rules
-rwxr-xr-x 1 root root 256320 Jan 1 1970 setupwizard.cgi
-rw-r--r-- 1 root root 0 Jan 1 1970 sroute
-rwxrwxrwx 1 root root 232379 Jun 8 05:19 test
-rw-r--r-- 1 root root 0 Jan 1 1970 usb_init
drwxrwxrwx 6 root root 0 Jan 1 1970 var
-r--r--r-- 1 root root 12 Jan 1 1970 wan_uptime
-r--r--r-- 1 root root 11 Jan 1 1970 wlan_uptime
lrwxrwxrwx 1 root root 8 Jan 1 1970 www -> /www.eng
# ./test
/bin/sh: ./test: not found
#
Back to top
View user's profile Send private message
ygrek
professional


Joined: 20 Mar 2010
Posts: 610

PostPosted: Fri Jun 08, 2012 1:00 pm    Post subject: Reply with quote

Compare the `file` output on this binary and any other system binary.
Show ldd ./test output.
Show strace -fttTx ./test output.
What is the operating system on the real cpu? This an unusual case - we need maximum information - any little detail may be important to pinpoint the issue.
_________________
Download | Report bugs | git mirror
Back to top
View user's profile Send private message Visit poster's website
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Mon Jun 11, 2012 8:26 am    Post subject: Reply with quote

ohh.. I can't do ldd...Becuase my router is using uclibc instead of glibc(to save memory size). Maybe this is the problem since the compiling mechine uses glibc...
I think I need to compile the Ocaml & MLdonkey with uclibc lib to match my router,right? Did you run mldonkey successfully on any uclibc device before?
----------------------------------------------------------
The system in my router:
# cat /proc/version
Linux version 2.6.30.9 (root@localhost.localdomain) (gcc version 3.4.6-1.3.6) #84 Tue Jun 5 15:38:24 CST 2012
# cat /proc/cpuinfo
system type : RTL8198
processor : 0
cpu model : 56322
BogoMIPS : 619.31
tlb_entries : 32
mips16 implemented : yes
#
# ls /lib
ld-uClibc-0.9.30.so libm-0.9.30.so
ld-uClibc.so libm.so
ld-uClibc.so.0 libm.so.0
lib3des.so libnsl-0.9.30.so
libb64.so libnsl.so
libc.so libnsl.so.0
libc.so.0 libntfs.so
libcms_boardctl.so libntfs.so.10
libcms_msg.so libntfs.so.10.0.0
libcms_util.so libntpass.so
libcrypt-0.9.30.so libntpass.so.0
libcrypt.so libntpass.so.0.0
libcrypt.so.0 libnvram.so
libcrypto.so libpppoe.so
libcrypto.so.0.9.7 libpthread-0.9.30.so
libcurl.so libpthread.so
libcurl.so.4 libpthread.so.0
libcyassl.so libresolv-0.9.30.so
libcyassl.so.0 libresolv.so
libdl-0.9.30.so libresolv.so.0
libdl.so librt-0.9.30.so
libdl.so.0 librt.so
libevent-2.1.so.1 librt.so.0
libevent_core-2.1.so.1 libsc_enc.so
libevent_extra-2.1.so.1 libscm_wl.so
libevent_pthreads-2.1.so.1 libscmisc.so
libflash.so libscnvram.so
libfuse.so libssl.so
libfuse.so.2 libssl.so.0.9.7
libfuse.so.2.7.4 libstdc++.so
libgcc.so libstdc++.so.6
libgcc_s.so libstdc++.so.6.0.3
libgcc_s.so.1 libtm_tools.so
libgcc_s_5281.so.1 libuClibc-0.9.30.so
libiconv.so libutil-0.9.30.so
libiconv.so.0 libutil.so
libiconv.so.0.0 libutil.so.0
libip_assign_chk.so libz.so
libixml.so libzebra.so.0
liblink.so modules
#
Back to top
View user's profile Send private message
ygrek
professional


Joined: 20 Mar 2010
Posts: 610

PostPosted: Mon Jun 11, 2012 11:19 am    Post subject: Reply with quote

That explains "not found" - the OS can't find dynamic loader referenced by executable (but it doesn't quite explain the segfault).

Indeed, you should build ocaml and mldonkey against uclibc. OCaml should definitely compile fine. Not sure about mldonkey - show problems as you encounter them and we will try to solve them.
_________________
Download | Report bugs | git mirror
Back to top
View user's profile Send private message Visit poster's website
spiralvoice
Sage


Joined: 06 Jan 2003
Posts: 4001
Location: Germany

PostPosted: Mon Jun 11, 2012 4:41 pm    Post subject: Reply with quote

jeffshao wrote:
Maybe this is the problem since the compiling mechine uses glibc...

Try either a statically compiled MLDonkey (make mlnet.static) or a chroot on your uclibc machine which contains glibc.
_________________
Link overview and precompiled cores here: http://mldonkey.sourceforge.net/DownloadLinks
Back to top
View user's profile Send private message
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Tue Jun 12, 2012 11:04 am    Post subject: Reply with quote

ygrek wrote:
That explains "not found" - the OS can't find dynamic loader referenced by executable (but it doesn't quite explain the segfault).

Indeed, you should build ocaml and mldonkey against uclibc. OCaml should definitely compile fine. Not sure about mldonkey - show problems as you encounter them and we will try to solve them.

Agree, "test.ml" doesn't work since there is no dynamic library, and not very sure about "mlnet.byte.static" segfault since the static binary should included the libs already... is there anyway to compile a test.ml as a static binary, so I can see if a simple static program works.
Today, I got another router(atheros cpu,uclibc) with worked mlnet, I'm not the developer, but it proved mlnet is able to work well with uclibc system. The mlnet is v3.0.7 on the atheros router, so I download the same version to my virtual mechine and compiled /built "mlnet.byte"&"mlnet.byte.static."
But the result in my RTL router is also fail.
------------------------------------------------------------
# ./mlnet.byte
/bin/sh: ./mlnet.byte: not found(I know it is caused by no glibc lib)
# ./mlnet.byte.static
Segmentation fault
#
---------------------------------------------------------------
I see some warning below during compiling mlnet.byte.static although I got the binary finally , do you think it hints some problem?
-----------------------------------------------------------------
root@debian-mips:/home/jeff/mldonkey-3.0.7# make mlnet.byte.static
/home/jeff/mldonkey-3.0.7/patches/local/bin/ocamlc -linkall -ccopt -static -o mlnet.byte.static \
-custom bigarray.cma unix.cma str.cma -ccopt " " -cclib "-lz " -ccopt "-pthread" \
\
-cclib "-lgd -ljpeg -lfreetype -lpng12 -lz -lm" -ccopt "-L/usr/lib" \
\
-cclib -lmagic \
\
\
-I build build/extlib.cma build/cdk.cma build/bitstring.cma build/magic.cma build/common.cma build/client.cma build/core.cma build/driver.cma src/daemon/common/commonMain.cmo
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libcamlrun.a(unix.o): In function `caml_dlopen':
unix.cSad.text+0x414): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(initgroups.o): In function `unix_initgroups':
initgroups.cSad.text+0x18): warning: Using 'initgroups' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getgr.o): In function `unix_getgrgid':
getgr.cSad.text+0x14c): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getgr.o): In function `unix_getgrnam':
getgr.cSad.text+0x1b4): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getpw.o): In function `unix_getpwnam':
getpw.cSad.text+0x230): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getpw.o): In function `unix_getpwuid':
getpw.cSad.text+0x1c8): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getaddrinfo.o): In function `unix_getaddrinfo':
getaddrinfo.cSad.text+0x2c0): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the sharedlibraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(gethost.o): In function `unix_gethostbyaddr':
gethost.cSad.text+0x3e8): warning: Using 'gethostbyaddr_r' in statically linked applications requires at runtime the sharedlibraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libcamlrun.a(debugger.o): In function `caml_debugger_init':
debugger.cSad.text+0x1068): warning: Using 'gethostbyname' in statically linked applications requires at runtime the sharedlibraries from the glibc version used for linking
src/utils/lib/stubs_c.o: In function `ml_gethostbyname':
/home/jeff/mldonkey-3.0.7/src/utils/lib/stubs_c.c:728: warning: Using 'gethostbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getproto.o): In function `unix_getprotobynumber':
getproto.cSad.text+0x118): warning: Using 'getprotobynumber' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getproto.o): In function `unix_getprotobyname':
getproto.cSad.text+0x180): warning: Using 'getprotobyname' in statically linked applications requires at runtime the sharedlibraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getserv.o): In function `unix_getservbyname':
getserv.cSad.text+0x1b4): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/home/jeff/mldonkey-3.0.7/patches/local/lib/ocaml/libunix.a(getserv.o): In function `unix_getservbyport':
getserv.cSad.text+0x14c): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
root@debian-mips:/home/jeff/mldonkey-3.0.7#
root@debian-mips:/home/jeff/mldonkey-3.0.7# ls
build configure distrib Install.txt mlnet.byte.static patches
ChangeLog Copying.txt docs Makefile ocamlpp.byte src
config Developers.txt icons mlnet.byte packages tools
Back to top
View user's profile Send private message
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Tue Jun 12, 2012 11:07 am    Post subject: Reply with quote

spiralvoice wrote:
jeffshao wrote:
Maybe this is the problem since the compiling mechine uses glibc...

Try either a statically compiled MLDonkey (make mlnet.static) or a chroot on your uclibc machine which contains glibc.

In consideration of the library unmatch, I have built mlnet.byte.static at beginning ,but it doesn't help...
------------------------------------------------
# ls -l mlnet.byte.static
-rwxrwxrwx 1 root root 5515256 Jun 12 13:34 mlnet.byte.static
#
# ./mlnet.byte.static
Segmentation fault
#
Back to top
View user's profile Send private message
ygrek
professional


Joined: 20 Mar 2010
Posts: 610

PostPosted: Tue Jun 12, 2012 1:59 pm    Post subject: Reply with quote

Yes, I guess those warnings may indeed be the reason of a crash, as you are not merely using different glibc version, but totally another libc!
So for the same reason mlnet.static will not work either (it is a native code version, not the bytecode as byte.static). Note that MIPS native code generator is not supported on linux and is removed entirely from the new release of ocaml (4.00), so you most probably will not be able to compile mlnet.static at all.
I think your only viable option is to get working uclibc toolchain in qemu and try to build mldonkey with it. Or get glibc on the router.
_________________
Download | Report bugs | git mirror
Back to top
View user's profile Send private message Visit poster's website
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Thu Jun 21, 2012 7:14 am    Post subject: Reply with quote

Hi there, I had a business trip previous days and now I can go back to this issue .
As I mentioned before,I have found an atheros mechine with worked mlnet and uclibc, so I'm trying to find out what it did.
Then I saw that , it seems include glibc libs also , I think it used glibc for mlnet and used uclibc for other program.
And more, the mlnet compiled by my qemu virtual mechine, works on the atheros mechine too..
Atheros Router:
Code:

:/lib# ls
config                libintl.so.0          libstdc++.so.6
ld-uClibc-0.9.28.so   libm-0.9.28.so        libstdc++.so.6.0.3
ld-uClibc.so.0        libm.so.0             libuClibc-0.9.28.so
ld.so.1               libnsl-0.9.28.so      libutil-0.9.28.so
libc.so.0             libnsl.so.0           libutil.so.0
libcrypt-0.9.28.so    libpthread-0.9.28.so  libwpa_common.so
libcrypt.so.0         libpthread.so.0       libwpa_ctrl.so
libdl-0.9.28.so       libresolv-0.9.28.so   modules
libdl.so.0            libresolv.so.0        network
libgcc_s.so.1         librt-0.9.28.so       usb_modeswitch.d
libintl-0.9.28.so     librt.so.0
download# ls
done_action.sh   libm.so.6        libz.so.1        version
downloads.ini    libnss_dns.so.2  mlnet.byte
libc.so.6        libpthread.so.0  servers.ini
libdl.so.2       libresolv.so.2   start_action.sh

So I think maybe I can do the same way in my Realtek Router.Copy all of the used glibc libs to my Realtek Router.
After that , the previous "not found" issue seems fixed,but unfortunately, another "Illegal instruction" issue occurs....
Then I copy a simple hello program from Qemu to atheros mechine and realtek mechine ,also , works in atheros , failed in realtek...
Realtek Router:
Code:

# ./mlnet.byte
Illegal instruction
# ./hello
Illegal instruction

Atheros Router:
Code:

root@WNR2200:~# ./hello
hello world

And more: even the ld.so.1 from qemu can NOT run on my Realtek mechine...
Code:

# ./ld.so.1 --list ./hello
Illegal instruction

Is the program from the Qemu mechine not suitable to be used on realtek mechine but OK for atheros mechine?gcc issue?kernel issue? It is really confused me ...
I will keep watching this , anyone have any idea on this?
I list the system info here.
Atheros:
Code:

Linux version 2.6.15 (root@sw02-desktop) (gcc version 3.4.4 (OpenWrt-2.0)) #1 Th
u Sep 15 19:16:26 CST 2011
# cat /proc/cpuinfo
system type             : Atheros AR7240 (Python)
processor               : 0
cpu model               : MIPS 24K V7.4
BogoMIPS                : 238.59
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : yes
ASEs implemented        : mips16
VCED exceptions         : not available
VCEI exceptions         : not available

Realtek:
Code:

Linux version 2.6.30.9 (root@localhost.localdomain) (gcc version 3.4.6-1.3.6) #66 Fri Jun 15 16:17:42 CST 2012
# cat /proc/cpuinfo
system type             : RTL8198
processor               : 0
cpu model               : 56322
BogoMIPS                : 619.31
tlb_entries             : 32
mips16 implemented      : yes
#

QEMU,debian
Code:

root@debian-mips:/home/jeff/tmp# cat /proc/version
Linux version 2.6.26-2-4kc-malta (Debian 2.6.26-26lenny1) (dannf@debian.org) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 Sat Nov 27 11:32:29 UTC 2010
root@debian-mips:/home/jeff/tmp# cat /proc/cpuinfo
system type             : MIPS Malta
processor               : 0
cpu model               : MIPS 24K V0.0  FPU V0.0
BogoMIPS                : 804.86
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : yes
ASEs implemented        : mips16
shadow register sets    : 1
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available
Back to top
View user's profile Send private message
ygrek
professional


Joined: 20 Mar 2010
Posts: 610

PostPosted: Thu Jun 21, 2012 9:27 am    Post subject: Reply with quote

MIPS family includes many processors and I guess they are not all compatible. So it appears atheros router uses the cpu that is compatible with qemu, but realtek is not. You should probably setup qemu compatible with realtek board. See the list of qemu-supported MIPS CPUs with :
Code:
qemu-mips -cpu ?

Have no idea which one will be working for you.
_________________
Download | Report bugs | git mirror
Back to top
View user's profile Send private message Visit poster's website
jeffshao
neophyte


Joined: 07 Jun 2012
Posts: 7

PostPosted: Fri Jun 22, 2012 1:44 am    Post subject: Reply with quote

I have asked the Realtek guy about the processor type, but they said the MIPS cpu used in 8198 is not genetical one , and doesn't support any thing except compiled by their cross-compile toolchian....oops....
Back to top
View user's profile Send private message
fabtar
Sage


Joined: 04 Feb 2004
Posts: 1581
Location: Italy

PostPosted: Tue Jul 31, 2012 10:23 am    Post subject: Reply with quote

you can try compiling a minimal core, disabling suid and all the other no-vital features. Perhaps youl''not trigger the unsupported features.
_________________
ARM,ARMEL,MIPS,MIPSEL,POWERPC mldonkey cores: http://fabtar.ygrek.org.ua/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    MLDonkey Forum Index -> Alternative platforms All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Sourceforge.net Logo