Perl calling C calling Ruby (linking problem)

Hi,

$ perl test.pl
Ruby exception: /opt/lib/ruby/1.6/i686-linux/digest/md5.so:
undefined symbol:
rb_cObject - /opt/lib/ruby/1.6/i686-linux/digest/md5.so
(eval): uninitialized constant Digest (NameError)
(eval): [BUG] Segmentation fault
ruby 1.6.7 (2002-03-01) [i686-linux]
Aborted

Do you link it with static library of ruby instead of shared
version?

Ah! yes, I built it with the static library. And thank you for the
response.

BUT… I’ve now built the dynamic Ruby library, and re-linked the code:

$ ldd regdb.so
libruby.so.1.6 => /usr/local/lib/libruby.so.1.6 (0x4001c000)
libm.so.6 => /lib/libm.so.6 (0x400e1000)
libdl.so.2 => /lib/libdl.so.2 (0x40103000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x40108000)
libc.so.6 => /lib/libc.so.6 (0x40135000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

And it still gives me this:
$ perl test.pl
Ruby exception: /opt/lib/ruby/1.6/i686-linux/digest/md5.so: undefined
symbol: rb_cObject - /opt/lib/ruby/1.6/i686-linux/digest/md5.so

Any thoughts?

Many thanks in advance,
Peter Munro

···

At Tue, 13 Aug 2002 06:36:33 +0900, >Peter Munro wrote:

Ruby exception: /opt/lib/ruby/1.6/i686-linux/digest/md5.so: undefined

Post your configuration, and the commands that you have executed

pigeon% ldd regdb.so
        libruby.so.1.6 => /home/ts/local/r167/lib/libruby.so.1.6 (0x40004000)
        libdl.so.2 => /lib/libdl.so.2 (0x400b6000)
        libm.so.6 => /lib/libm.so.6 (0x400ba000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x400db000)
        libc.so.6 => /lib/libc.so.6 (0x40108000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)
pigeon%

pigeon% cat a.pl
#!/usr/bin/perl -l
use regdb;
$res = regdb::runruby("
   require 'digest/md5'
   Digest::MD5.new('hello')
");
print $res;
pigeon%

pigeon% perl a.pl
5d41402abc4b2a76b9719d911017c592
pigeon%

Guy Decoux