From: Brian Candler Date: 2003-07-23T21:00:23+09:00 Subject: Re: Embedding problem - SEGV On Wed, Jul 23, 2003 at 08:49:38PM +0900, Brian Candler wrote: > It seems to work, but the problem is that untrapped exceptions cause a SEGV > and a core dump. Spoke too soon - requiring a .so also causes it to segfault. $ cat embed.c #include #include int main(void) { printf("Starting\n"); ruby_init(); ruby_init_loadpath(); ruby_script("embed"); rb_require("socket"); /* <<< segfaults here */ #if RUBY_VERSION_CODE >= 180 rb_cleanup(0); #endif printf("Done\n"); return 0; } The backtrace is not helpful though: (gdb) bt #0 0x28150b78 in kill () from /usr/lib/libc.so.4 #1 0x28191742 in abort () from /usr/lib/libc.so.4 #2 0x80afb92 in rb_bug (fmt=0x80c54ce "Segmentation fault") at error.c:179 #3 0x8097667 in sigsegv (sig=11) at signal.c:393 #4 0xbfbfffac in ?? () #5 0x8055ab0 in rb_require (fname=0x80b0f91 "socket") at eval.c:5538 #6 0x804a809 in main () at embed.c:10 #7 0x804a73d in _start () So it's definitely looks like some missing initialisation. rb_load_file("/dev/null") doesn't help, and I can't use ruby_run() because that exits the C program. Thanks for any suggestions... Brian.