From: hiro sugawara Date: 2009-02-25T09:37:32+09:00 Subject: [ruby-core:22439] [Bug #1205] SET_STACK_END crashes due to uninitialized ruby_current_thread Bug #1205: SET_STACK_END crashes due to uninitialized ruby_current_thread http://redmine.ruby-lang.org/issues/show/1205 Author: hiro sugawara Status: Open, Priority: High Category: core ruby -v: 1.9.1-p0 I ported ruby-1.9.1-p0 to Android. It built fine with a few patches and a custom Android.mk with a target of "miniruby." The executable crashed at an early stage. I succeeded in tracing the crash to a null pointer reference to ruby_current_thread in SET_STACK_END (through GET_THREAD()) called in ruby_get_stack_grow_direction() called in STACK_UPPER() called in ruby_init_stack() called in Init_stack(). Reversing the calling order of Init_BareVM() and Init_stack in eval.c:ruby_init() seems to fix the problem. Am I right? Thanks, hiro ruby-1.9.1-p0/eval.c ==== *************** *** 56,63 **** rb_origenviron = environ; Init_stack((void *)&state); ! Init_BareVM(); Init_heap(); PUSH_TAG(); --- 56,64 ---- rb_origenviron = environ; + Init_BareVM(); Init_stack((void *)&state); ! //Init_BareVM(); Init_heap(); PUSH_TAG(); ---------------------------------------- http://redmine.ruby-lang.org