This is probably a platform thing, I'm using cvs ruby
on NetBSD 1.6Z ...

I can use most ruby libs ok, but there's a coredump whenever
I try to use a shared library
(seen it so far in ruby-ldap and ruby-postgresql)

My guess is there's a problem in my build of ruby itself, does
anyone know if there's something I missed?

I just did a bog standard 
'./configure --prefix=/data/ruby;make;make install'
to get ruby in, and a 
'ruby extconf.rb --with-pgsql=/usr/pkg;make;make install'
to add ruby-postgresql

The only thing I can think of is that you often need to add
a '-Wl,R/lib/dir' to gcc compiles on NetBSD, but I noticed
the ruby-postgresql lib does figure that out, so I guess extconf.rb
is at least aware of it?

Example backtrace below:

rasputin@lb:lib$ ruby -rpostgres -e ""
Abort trap (core dumped)
rasputin@lb:lib$ gdb /data/ruby/bin/ruby ruby.core
GNU gdb 5.0nb1
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsdelf"...Deprecated bfd_read called at /usr/src/gnu/dist/toolchain/gdb/dbxread.c line 2638 in elfstab_build_psymtabs
Deprecated bfd_read called at /usr/src/gnu/dist/toolchain/gdb/dbxread.c line 976 in fill_symbuf

Core was generated by `ruby'.
Program terminated with signal 6, Abort trap.
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Reading symbols from /usr/lib/libcrypt.so.0...done.
Loaded symbols for /usr/lib/libcrypt.so.0
Reading symbols from /usr/lib/libm387.so.0...done.
Loaded symbols for /usr/lib/libm387.so.0
Reading symbols from /usr/lib/libm.so.0...done.
Loaded symbols for /usr/lib/libm.so.0
Reading symbols from /usr/lib/libc.so.12...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from /data/ruby/lib/ruby/site_ruby/1.9/i386-netbsdelf/postgres.so...done.
Loaded symbols for /data/ruby/lib/ruby/site_ruby/1.9/i386-netbsdelf/postgres.so
Reading symbols from /usr/pkg/lib/libpq.so.3...done.
Loaded symbols for /usr/pkg/lib/libpq.so.3
Reading symbols from /usr/lib/libssl.so.3...done.
Loaded symbols for /usr/lib/libssl.so.3
Reading symbols from /usr/lib/libcrypto.so.2...done.
Loaded symbols for /usr/lib/libcrypto.so.2
Reading symbols from /usr/lib/libresolv.so.1...done.
Loaded symbols for /usr/lib/libresolv.so.1
Reading symbols from /usr/lib/libintl.so.0...done.
Loaded symbols for /usr/lib/libintl.so.0
Reading symbols from /usr/lib/libpthread.so.0...done.
Loaded symbols for /usr/lib/libpthread.so.0
#0  0x4814669f in kill () from /usr/lib/libc.so.12
(gdb) bt
#0  0x4814669f in kill () from /usr/lib/libc.so.12
#1  0x4814871b in __libc_mutex_unlock () from /usr/lib/libc.so.12
#2  0x481b8b7b in malloc () from /usr/lib/libc.so.12
#3  0x806bd84 in ruby_xmalloc (size=380) at gc.c:116
#4  0x80ce635 in onig_alloc_init (reg=0xbfbff0c4, option=0, enc=0x80f7940, syntax=0x80f5b00) at regcomp.c:4833
#5  0x80a1d88 in re_alloc_pattern (reg=0xbfbff0c4) at reggnu.c:114
#6  0x8099977 in make_regexp (s=0x481e05e9 "([\\t\\n\\\\])", len=10, flags=0) at re.c:636
#7  0x809a5eb in rb_reg_initialize (obj=135436308, s=0x481e05e9 "([\\t\\n\\\\])", len=10, options=0) at re.c:1368
#8  0x809a6a7 in rb_reg_new (s=0x481e05e9 "([\\t\\n\\\\])", len=10, options=0) at re.c:1401
#9  0x481df5a0 in Init_postgres () from /data/ruby/lib/ruby/site_ruby/1.9/i386-netbsdelf/postgres.so
#10 0x80c50f1 in dln_load (file=0x815e300 "/data/ruby/lib/ruby/site_ruby/1.9/i386-netbsdelf/postgres.so") at dln.c:1336
#11 0x805f8b3 in rb_require_safe (fname=135436488, safe=0) at eval.c:6757
#12 0x805f9af in rb_require (fname=0x815dbe0 "postgres") at eval.c:6789
#13 0x80a81d4 in require_libraries () at ruby.c:360
#14 0x80a8e98 in proc_options (argc=0, argv=0xbfbff4c4) at ruby.c:781
#15 0x80a9638 in ruby_process_options (argc=4, argv=0xbfbff4b4) at ruby.c:1137
#16 0x8054b20 in ruby_options (argc=4, argv=0xbfbff4b4) at eval.c:1370
#17 0x8053329 in main (argc=4, argv=0xbfbff4b4, envp=0xbfbff4c8) at main.c:49
#18 0x80530f4 in ___start ()
(gdb) quit

-- 
Those who can't write, write manuals.
Rasputin :: Jack of All Trades - Master of Nuns