ruby CVS can't use shared libs on NetBSD

D

Dick Davies

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
 
T

ts

D> Reading symbols from /usr/lib/libpthread.so.0...done.
D> Loaded symbols for /usr/lib/libpthread.so.0

PostgreSQL was compiled with -lpthread ?

In this case, you need to compile ruby with --enable-pthread


Guy Decoux
 
D

Dick Davies

* ts said:
D> Reading symbols from /usr/lib/libpthread.so.0...done.
D> Loaded symbols for /usr/lib/libpthread.so.0

PostgreSQL was compiled with -lpthread ?

In this case, you need to compile ruby with --enable-pthread

Ah, that falls over when miniruby dumps core trying to build digest-md5...

rasputin@lb:ruby$ make
compiling digest/md5
[1] Illegal instruction (core dumped) ./miniruby ./ext...
*** Error code 132

Stop.
make: stopped in /home/rasputin/rubybits/cvs/ruby
rasputin@lb:ruby$ gdb miniruby ext/digest/md5/miniruby.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"

Core was generated by `miniruby'.
Program terminated with signal 4, Illegal instruction.
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Reading symbols from /usr/lib/libpthread.so.0...done.
Loaded symbols for /usr/lib/libpthread.so.0
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
#0 0x80572d5 in rb_eval (self=135502304, n=0x81d1864) at eval.c:2638
2638 }
(gdb) bt
#0 0x80572d5 in rb_eval (self=135502304, n=0x81d1864) at eval.c:2638
#1 0x805df5b in rb_call0 (klass=135507224, recv=135502304, id=11369, oid=11369, argc=0, argv=0xbfbc3638, body=0x81d0f2c,
nosuper=0) at eval.c:5584
#2 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=11369, argc=2, argv=0xbfbc3638, scope=1) at eval.c:5696
#3 0x80590a0 in rb_eval (self=135502304, n=0x81d011c) at eval.c:3238
#4 0x8058f0f in rb_eval (self=135502304, n=0x81d00cc) at eval.c:3233
#5 0x8062911 in block_pass (self=135502304, node=0x81d00e0) at eval.c:8336
#6 0x8057d78 in rb_eval (self=135502304, n=0x81d01d0) at eval.c:2929
#7 0x805dfdf in rb_call0 (klass=135507224, recv=135502304, id=11481, oid=11481, argc=0, argv=0xbfbc7e88, body=0x81d01d0,
nosuper=0) at eval.c:5603
#8 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=11481, argc=2, argv=0xbfbc7e88, scope=1) at eval.c:5696
#9 0x80590a0 in rb_eval (self=135502304, n=0x81cfeec) at eval.c:3238
#10 0x8062911 in block_pass (self=135502304, node=0x81cff00) at eval.c:8336
#11 0x8057d78 in rb_eval (self=135502304, n=0x81cff00) at eval.c:2929
#12 0x805855a in rb_eval (self=135502304, n=0x81cff8c) at eval.c:3079
#13 0x805dfdf in rb_call0 (klass=135507224, recv=135502304, id=11489, oid=11489, argc=0, argv=0xbfbcc6c8, body=0x81cff8c,
nosuper=0) at eval.c:5603
#14 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=11489, argc=2, argv=0xbfbcc6c8, scope=1) at eval.c:5696
#15 0x80590a0 in rb_eval (self=135502304, n=0x81cd5ac) at eval.c:3238
#16 0x8062911 in block_pass (self=135502304, node=0x81cd5c0) at eval.c:8336
#17 0x8057d78 in rb_eval (self=135502304, n=0x81cd5c0) at eval.c:2929
#18 0x805991e in rb_eval (self=135502304, n=0x81cd818) at eval.c:3379
#19 0x805dfdf in rb_call0 (klass=135507224, recv=135502304, id=11609, oid=11609, argc=0, argv=0xbfbd0f08, body=0x81cd818,
nosuper=0) at eval.c:5603
#20 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=11609, argc=2, argv=0xbfbd0f08, scope=1) at eval.c:5696
#21 0x80590a0 in rb_eval (self=135502304, n=0x81c93d0) at eval.c:3238
#22 0x8062911 in block_pass (self=135502304, node=0x81c93e4) at eval.c:8336
#23 0x8057d78 in rb_eval (self=135502304, n=0x81c93e4) at eval.c:2929
#24 0x8057792 in rb_eval (self=135502304, n=0x81c9254) at eval.c:2770
#25 0x805bce1 in rb_yield_0 (val=6, self=135502304, klass=0, flags=0, avalue=0) at eval.c:4687
#26 0x80582e3 in rb_eval (self=135502304, n=0x81c9dbc) at eval.c:3019
#27 0x8059996 in rb_eval (self=135502304, n=0x81c9d08) at eval.c:3393
#28 0x805bce1 in rb_yield_0 (val=6, self=135502304, klass=0, flags=0, avalue=0) at eval.c:4687
#29 0x80582e3 in rb_eval (self=136011656, n=0x81d2e94) at eval.c:3019
#30 0x805bce1 in rb_yield_0 (val=6, self=136011656, klass=0, flags=0, avalue=0) at eval.c:4687
#31 0x80582e3 in rb_eval (self=136011656, n=0x81d3b00) at eval.c:3019
#32 0x805855a in rb_eval (self=136011656, n=0x81d386c) at eval.c:3079
#33 0x805dfdf in rb_call0 (klass=136005336, recv=136011656, id=7001, oid=7001, argc=0, argv=0x0, body=0x81d386c, nosuper=0)
at eval.c:5603
#34 0x805e458 in rb_call (klass=136005336, recv=136011656, mid=7001, argc=0, argv=0x0, scope=1) at eval.c:5696
#35 0x80590a0 in rb_eval (self=136011656, n=0x81d2e6c) at eval.c:3238
#36 0x8057f41 in rb_eval (self=136011656, n=0x81d2e80) at eval.c:2943
#37 0x8058ca3 in rb_eval (self=136011656, n=0x81d2df4) at eval.c:3218
#38 0x805855a in rb_eval (self=136011656, n=0x81d2a5c) at eval.c:3079
#39 0x805bce1 in rb_yield_0 (val=6, self=136011656, klass=0, flags=0, avalue=0) at eval.c:4687
#40 0x80582e3 in rb_eval (self=136011656, n=0x81d3b00) at eval.c:3019
#41 0x805855a in rb_eval (self=136011656, n=0x81d386c) at eval.c:3079
#42 0x805dfdf in rb_call0 (klass=136005336, recv=136011656, id=7001, oid=7001, argc=0, argv=0x0, body=0x81d386c, nosuper=0)
at eval.c:5603
#43 0x805e458 in rb_call (klass=136005336, recv=136011656, mid=7001, argc=0, argv=0x0, scope=1) at eval.c:5696
#44 0x80590a0 in rb_eval (self=136011656, n=0x81d2a34) at eval.c:3238
#45 0x8057f41 in rb_eval (self=136011656, n=0x81d2a20) at eval.c:2943
#46 0x805dfdf in rb_call0 (klass=136005336, recv=136011656, id=11265, oid=11265, argc=0, argv=0x0, body=0x81d2a20,
nosuper=0) at eval.c:5603
#47 0x805e458 in rb_call (klass=136005336, recv=136011656, mid=11265, argc=0, argv=0x0, scope=0) at eval.c:5696
---Type <return> to continue, or q <return> to quit---
#48 0x8058e43 in rb_eval (self=135502304, n=0x81c9e0c) at eval.c:3223
#49 0x8057f41 in rb_eval (self=135502304, n=0x81ca000) at eval.c:2943
#50 0x805dfdf in rb_call0 (klass=135507224, recv=135502304, id=11753, oid=11753, argc=0, argv=0xbfbead38, body=0x81ca000,
nosuper=0) at eval.c:5603
#51 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=11753, argc=1, argv=0xbfbead38, scope=1) at eval.c:5696
#52 0x80590a0 in rb_eval (self=135502304, n=0x81c95c4) at eval.c:3238
#53 0x8057f41 in rb_eval (self=135502304, n=0x81c98e4) at eval.c:2943
#54 0x805dfdf in rb_call0 (klass=135507224, recv=135502304, id=11769, oid=11769, argc=0, argv=0xbfbedd28, body=0x81c98e4,
nosuper=0) at eval.c:5603
#55 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=11769, argc=1, argv=0xbfbedd28, scope=1) at eval.c:5696
#56 0x80590a0 in rb_eval (self=135502304, n=0x818ca34) at eval.c:3238
#57 0x8058602 in rb_eval (self=135502304, n=0x818ca20) at eval.c:3094
#58 0x8057792 in rb_eval (self=135502304, n=0x818d448) at eval.c:2770
#59 0x8054c5c in eval_node (self=135502304, node=0x818d448) at eval.c:1285
#60 0x805fa59 in rb_load (fname=135847256, wrap=0) at eval.c:6443
#61 0x805fcd3 in rb_f_load (argc=1, argv=0xbfbf2598) at eval.c:6511
#62 0x805d9b2 in rb_call0 (klass=135507104, recv=135502304, id=9225, oid=9225, argc=1, argv=0xbfbf2598, body=0x812c024,
nosuper=0) at eval.c:5357
#63 0x805e458 in rb_call (klass=135507104, recv=135502304, mid=9225, argc=1, argv=0xbfbf2598, scope=1) at eval.c:5696
#64 0x80590a0 in rb_eval (self=135502304, n=0x8128230) at eval.c:3238
#65 0x805842c in rb_eval (self=135502304, n=0x8127f74) at eval.c:3054
#66 0x805855a in rb_eval (self=135502304, n=0x81270ec) at eval.c:3079
#67 0x805991e in rb_eval (self=135502304, n=0x8129284) at eval.c:3379
#68 0x805855a in rb_eval (self=135502304, n=0x8129798) at eval.c:3079
#69 0x805dfdf in rb_call0 (klass=135507224, recv=135502304, id=10097, oid=10097, argc=0, argv=0xbfbf92e8, body=0x8129798,
nosuper=0) at eval.c:5603
#70 0x805e458 in rb_call (klass=135507224, recv=135502304, mid=10097, argc=1, argv=0xbfbf92e8, scope=1) at eval.c:5696
#71 0x80590a0 in rb_eval (self=135502304, n=0x8120b70) at eval.c:3238
#72 0x805991e in rb_eval (self=135502304, n=0x8120b48) at eval.c:3379
#73 0x805bce1 in rb_yield_0 (val=135870956, self=135502304, klass=0, flags=0, avalue=0) at eval.c:4687
#74 0x805bfcd in rb_yield (val=135870956) at eval.c:4769
#75 0x80bcb3a in rb_ary_each (ary=135870976) at array.c:1155
#76 0x805d979 in rb_call0 (klass=135479044, recv=135870976, id=3849, oid=3849, argc=0, argv=0x0, body=0x8133ae0, nosuper=0)
at eval.c:5348
#77 0x805e458 in rb_call (klass=135479044, recv=135870976, mid=3849, argc=0, argv=0x0, scope=0) at eval.c:5696
#78 0x8058e43 in rb_eval (self=135502304, n=0x8120bfc) at eval.c:3223
#79 0x8057f41 in rb_eval (self=135502304, n=0x812a788) at eval.c:2943
#80 0x8054c5c in eval_node (self=135502304, node=0x812a788) at eval.c:1285
#81 0x80551bd in ruby_exec () at eval.c:1454
#82 0x8055219 in ruby_run () at eval.c:1475
#83 0x805358e in main () at main.c:50
#84 0x8053354 in ___start ()
(gdb) quit
 
E

Elias Athanasopoulos

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)

Actually, I had also some ruby coredumps while developing an
extension on Linux. Apparently, it was my fault; while I was
tweaking my code, it seems that a simple 'make' resulted to
a broken shared lib.

This happened quite a few times. The solution was to do a
'make clean' and then rebuild my extension.

Apart from the above, what I wanted to say here is: should ruby
coredump?

I think it should not for any reason.

I may be bogus on that, but I believe there must be some way
to abort on dlopen() when something seems to go wrong. ANW, I
can offer my help and my time to fix the problem if it is
something that can be achieved.

Last but not least, I tried to reproduce the coredump with no
avail.

Regards,
 
D

Dick Davies

* Elias Athanasopoulos said:
Actually, I had also some ruby coredumps while developing an
extension on Linux. Apparently, it was my fault; while I was
tweaking my code, it seems that a simple 'make' resulted to
a broken shared lib.

This happened quite a few times. The solution was to do a
'make clean' and then rebuild my extension.

Apart from the above, what I wanted to say here is: should ruby
coredump?

I think it should not for any reason.

Not ideally, but it's a CVS build - and it's a C library issue
at the end of the day.
I may be bogus on that, but I believe there must be some way
to abort on dlopen() when something seems to go wrong.

But if it didn't dump core. how would you find out why it failed?
Last but not least, I tried to reproduce the coredump with no
avail.

Like I said, it's almost certainly a platform issue. The fact that
using pthreads breaks the build is a bit of a giveaway..
 
E

Elias Athanasopoulos

Not ideally, but it's a CVS build - and it's a C library issue
at the end of the day.

In my case it was ruby 1.8/1.8.1. Even if it's the case of an
extension Ruby, IMHO, should never core dump. The core is produced
in the Ruby load code; not inside the extension.
But if it didn't dump core. how would you find out why it failed?

The core was dumped because Ruby had received a SEGV and not the
code inside in the extension. I.e., you could force Ruby to
segfault by:

% ruby -rfoo -e ''

Regards,
 
D

Dick Davies

* Dick Davies said:
* ts said:
D> Reading symbols from /usr/lib/libpthread.so.0...done.
D> Loaded symbols for /usr/lib/libpthread.so.0

PostgreSQL was compiled with -lpthread ?

In this case, you need to compile ruby with --enable-pthread

Ah, that falls over when miniruby dumps core trying to build digest-md5...

rasputin@lb:ruby$ make
compiling digest/md5
[1] Illegal instruction (core dumped) ./miniruby ./ext...
*** Error code 132

Ack. Scrub that, that box has a ropey pthread install.
Sorry for the noise, I'll try an --enable-pthread install of ruby again...
 
T

ts

D> Ah, that falls over when miniruby dumps core trying to build digest-md5...

Well, I really dont know : I don't have NetBSD

obsd% ruby -vrmd5 -e 'p MD5.new()'
ruby 1.9.0 (2004-04-30) [sparc-openbsd3.4]
d41d8cd98f00b204e9800998ecf8427e
obsd%

obsd% ldd ruby
ruby:
Start End Type Ref Name
00000000 00000000 exe 1 ruby
08f9a000 095b4000 rlib 1 /usr/lib/libpthread.so.2.1
095b4000 09be3000 rlib 1 /usr/lib/libm.so.1.0
088da000 08f9a000 rlib 1 /usr/lib/libc.so.30.1
082d0000 082d0000 rtld 1 /usr/libexec/ld.so
obsd%



Guy Decoux
 
D

Dick Davies

* Dick Davies said:
* Dick Davies said:
* ts said:
D> Reading symbols from /usr/lib/libpthread.so.0...done.
D> Loaded symbols for /usr/lib/libpthread.so.0

PostgreSQL was compiled with -lpthread ?

In this case, you need to compile ruby with --enable-pthread

Ah, that falls over when miniruby dumps core trying to build digest-md5...

rasputin@lb:ruby$ make
compiling digest/md5
[1] Illegal instruction (core dumped) ./miniruby ./ext...
*** Error code 132

Ack. Scrub that, that box has a ropey pthread install.
Sorry for the noise, I'll try an --enable-pthread install of ruby again...

Just for the record, this is all working great now - ruby was linking against
gnu pthread instead of the system one.

On NetBSD, you need to change all the '-lpthread' flags in configure to just
'-pthread' - i.e. it's a compiler flag rather than a library.

Thanks for all the pointers.
 
T

ts

D> On NetBSD, you need to change all the '-lpthread' flags in configure to just
D> '-pthread' - i.e. it's a compiler flag rather than a library.

Well, you can submit perhaps a patch for configure.in, no ?


Guy Decoux
 
D

Dick Davies

* ts said:
D> On NetBSD, you need to change all the '-lpthread' flags in configure to just
D> '-pthread' - i.e. it's a compiler flag rather than a library.

Well, you can submit perhaps a patch for configure.in, no ?

I could if I had the first clue what all the line noise in a
configure script did, but I don't, and I don't really want to.

libtool/configure/m4 and to a lesser extent make are the sendmails
of the development world, and being a mortal, I don't want to
learn them. I turned 30 this week, so will probably be dead soon.

--
Tell me, O Octopus, I begs,
Is those things arms, or is they legs?
I marvel at thee, Octopus;
If I were thou, I'd call me us.
-- Ogden Nash
Rasputin :: Jack of All Trades - Master of Nuns
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top