thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Reiss <dre...@facebook.com>
Subject Re: Use Thrift in the OpenWRT platform
Date Tue, 21 Oct 2008 19:58:08 GMT
Can you please report the following...

1/ If you can run your program under gdb, please do so.  When it crashes,
execute the "backtrace" command.  Paste the results.

2/ execute the command "break setrlimit", then "run" (say "yes" when it
asks you if you want to start your program from the beginning).  It should
stop right before calling setrlimit.  Paste the backtrace.

Please make sure that you have compiled Thrift for debugging.
("./configure CXXFLAGS='-O0 -g'").

--David

Siamak Haschemi wrote:
> Hello again,
> 
> the Hello world program without the thrift library linked shows this
> strace (only the last relevant lines included):
> 
> 
> ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
> ...}) = 0
> brk(0)                                  = 0x88a7000
> brk(0x88a8000)                          = 0x88a8000
> write(1, "Hello World\n", 12Hello World
> )           = 12
> _exit(0)
> 
> 
> For me, it looks like an problem with "getrlimit" or "setrlimit" function.
> 
> Lind regards,
> 
> Siamak Haschemi
> 
> Siamak Haschemi schrieb:
>> Hello again,
>>
>> I don't know if it helps, but here is some more information:
>>
>>
>>
>> root@OpenWrt:~# ldd ./hello
>>         libthrift.so.0 => /lib/libthrift.so.0 (0xb7f23000)
>>         libstdc++.so.6 => /lib/libstdc++.so.6 (0xb7e68000)
>>         libm.so.0 => /lib/libm.so.0 (0xb7e5b000)
>>         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e52000)
>>         libc.so.0 => /lib/libc.so.0 (0xb7e08000)
>>         librt.so.0 => /lib/librt.so.0 (0xb7e05000)
>>         libpthread.so.0 => /lib/libpthread.so.0 (0xb7df3000)
>>         ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0xb7fb9000)
>>
>>
>>
>> root@OpenWrt:~# strace ./hello
>> execve("/bin/hello", ["/bin/hello"], [/* 8 vars */]) = 0
>> mmap2(NULL, 20, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
>> = 0xb7f52000
>> stat("/etc/ld.so.cache", 0xbff56254)    = -1 ENOENT (No such file or
>> directory)
>> open("/lib/libthrift.so.0", O_RDONLY)   = 3
>> fstat(3, {st_mode=S_IFREG|0755, st_size=604571, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20q\2\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 606208, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
>> 0xb7ebd000
>> mmap2(0xb7ebd000, 591833, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7ebd000
>> mmap2(0xb7f4e000, 10651, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0x91) = 0xb7f4e000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/libstdc++.so.6", O_RDONLY)   = 3
>> fstat(3, {st_mode=S_IFREG|0755, st_size=741369, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0,\0\4\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 765952, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
>> 0xb7e02000
>> mmap2(0xb7e02000, 719316, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7e02000
>> mmap2(0xb7eb2000, 20473, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0xb0) = 0xb7eb2000
>> mmap2(0xb7eb7000, 23828, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7eb7000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/libm.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=45080, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0t\21\0\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 53248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7df5000
>> mmap2(0xb7df5000, 41028, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7df5000
>> mmap2(0xb7e00000, 4120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0xa) = 0xb7e00000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=31974, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0H\25\0\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 36864, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7dec000
>> mmap2(0xb7dec000, 31592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7dec000
>> mmap2(0xb7df4000, 3302, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0x7) = 0xb7df4000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\251\0\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 303104, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
>> 0xb7da2000
>> mmap2(0xb7da2000, 271528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7da2000
>> mmap2(0xb7de5000, 5309, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0x42) = 0xb7de5000
>> mmap2(0xb7de7000, 16988, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7de7000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/librt.so.0", O_RDONLY)       = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=4110, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\344\4\0\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 12288, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d9f000
>> mmap2(0xb7d9f000, 2336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7d9f000
>> mmap2(0xb7da0000, 4110, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7da0000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/libpthread.so.0", O_RDONLY)  = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=58930, ...}) = 0
>> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>> 0) = 0xb7f51000
>> read(3,
>> "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0004=\0\0004\0\0\0"...,
>> 4096) = 4096
>> mmap2(NULL, 73728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d8d000
>> mmap2(0xb7d8d000, 37304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3,
>> 0) = 0xb7d8d000
>> mmap2(0xb7d97000, 22066, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
>> 0x9) = 0xb7d97000
>> mmap2(0xb7d9d000, 6232, PROT_READ|PROT_WRITE,
>> MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7d9d000
>> close(3)                                = 0
>> munmap(0xb7f51000, 4096)                = 0
>> open("/lib/libstdc++.so.6", O_RDONLY)   = 3
>> fstat(3, {st_mode=S_IFREG|0755, st_size=741369, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libm.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=45080, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=31974, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libm.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=45080, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=31974, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> close(3)                                = 0
>> open("/lib/libc.so.0", O_RDONLY)        = 3
>> fstat(3, {st_mode=S_IFREG|0644, st_size=275645, ...}) = 0
>> close(3)                                = 0
>> stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=16390, ...}) = 0
>> mprotect(0xb7eb2000, 16384, PROT_READ)  = 0
>> mprotect(0xb7e00000, 4096, PROT_READ)   = 0
>> mprotect(0xb7de5000, 4096, PROT_READ)   = 0
>> mprotect(0xb7da0000, 4096, PROT_READ)   = 0
>> mprotect(0xb7d97000, 4096, PROT_READ)   = 0
>> mprotect(0xb7f57000, 4096, PROT_READ)   = 0
>> ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
>> ...}) = 0
>> ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
>> ...}) = 0
>> getpid()                                = 2933
>> getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
>> setrlimit(RLIMIT_STACK, {rlim_cur=2040*1024, rlim_max=RLIM_INFINITY}) = 0
>> rt_sigaction(SIGRTMIN, {0xb7d95f96, [], SA_RESTORER, 0xb7dac998}, NULL,
>> 8) = 0
>> rt_sigaction(SIGRT_1, {0xb7d95efe, [RTMIN], SA_RESTORER, 0xb7dac998},
>> NULL, 8) = 0
>> rt_sigaction(SIGRT_2, {0xb7d9562a, [], SA_RESTORER, 0xb7dac998}, NULL,
>> 8) = 0
>> rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0
>> rt_sigprocmask(SIG_UNBLOCK, [RT_1], NULL, 8) = 0
>> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
>> +++ killed by SIGSEGV +++
>>
>>
>>
>> Kind regards,
>>
>> Siamak Haschemi
>>
>> Siamak Haschemi schrieb:
>>> Hello,
>>>
>>> as you seen here (https://issues.apache.org/jira/browse/THRIFT-177), I
>>> am trying to cross-compile Thrift for the OpenWRT platform
>>> (http://openwrt.org/), which is a Linux distribution for embedded devices.
>>>
>>> After a two-night-fight, my result are the following:
>>>
>>> - I've created a OpenWRT package for thrift (see the attachment if you
>>> are interested).
>>> - I've successfully compiled the cpp-library (which results in
>>> libthrift, libthriftz and libthriftnb)
>>> - For now, I will not cross-compile the thrift-compiler since I will
>>> compile the thrift definition files on my PC.
>>>
>>> Coming to this point, I was very happy and I thought that the story
>>> ends, but now I am faced with a problem I cannot solve myself:
>>>
>>> For testing my cross-compilation result, I cross-compiled the cpp-part
>>> of the thrift tutorial. I installed the cross-compiled libraries on the
>>> target device and start the CppServer and the only reaction was
>>> "Segmentation Fault" :-(
>>>
>>>
>>> I tried to backtrack the problem and I came to the finding, that a
>>> simple hello world program, which is linked to my cross-compiled
>>> thrift-library, causes the "Segmentation Fault". Without linking the
>>> thrift-library, everything is O.K.
>>>
>>>
>>> =======================
>>> ------------
>>> Hello.cpp
>>> ------------
>>>
>>> #include <iostream>
>>>
>>> using namespace std;
>>>
>>> int main(int argc, char **argv) {
>>>   printf("Hello World!\n");
>>>   return 0;
>>> }
>>>
>>> 1) First try
>>>
>>> $ i386-linux-uclibc-g++ -L${LIB_DIR} -levent *-lthrift* -o Hello Hello.cpp
>>>
>>> On the target device:
>>>
>>> root@OpenWrt:~# ./Hello
>>> Segmentation fault
>>>
>>> 2) Second try
>>>
>>> $ i386-linux-uclibc-g++ -L${LIB_DIR} -levent -o Hello Hello.cpp
>>>
>>> On the target device:
>>>
>>> root@OpenWrt:~# ./Hello
>>> Hello World!
>>>
>>> ======================
>>>
>>> I will try to debug it with gdb, but I'm not an expert in this.
>>>
>>>
>>> So, please, can someone help me?
>>>
>>>
>>>
>>> Kind regards,
>>>
>>> Siamak Haschemi
>>>
>>>
>>>
>>>
>>>

Mime
View raw message