Bdb 0.5.0 problem with ruby 1.8

Hi

Got a trouble with bdb 0.5.0 (ruby lib for Berkley DB) with ruby 1.8.

Trying to do the following
  BDB::Hash.open(path_to_db, nil, BDB::RDONLY, 0644)

I get the messages

warning: defining BDB::Env.allocate is deprecated; use use_define_alloc_func()

warning: defining BDB::Common.allocate is deprecated; use rb_define_alloc_func()

How can I get it work?

Many many thanks in advance

Nikolai

···

--
Bore, n.:
  A guy who wraps up a two-minute idea in a two-hour vocabulary.
    -- Walter Winchell

  BDB::Hash.open(path_to_db, nil, BDB::RDONLY, 0644)

I get the messages

warning: defining BDB::Env.allocate is deprecated; use
use_define_alloc_func()

???

svg% ruby -vrbdb -e 'BDB::Hash.open("/tmp/aa", nil, BDB::RDONLY, 0644)'
ruby 1.8.1 (2003-12-25) [i686-linux]
svg%

Do you have HAVE_RB_DEFINE_ALLOC_FUNC in intern.h (source of ruby) ?

svg% grep HAVE_RB_DEFINE_ALLOC_FUNC ~/ruby/ruby-1.8.1/*.h
/home/ts/ruby/ruby-1.8.1/intern.h:#define HAVE_RB_DEFINE_ALLOC_FUNC 1
svg%

This is a version of bdb compiled with ruby 1.8 ?

Guy Decoux

thank you for your quick reply.

ts wrote:

"N" == Nikolai Krot <fake_address@microsoft.com> writes:

> BDB::Hash.open(path_to_db, nil, BDB::RDONLY, 0644)

> I get the messages

> warning: defining BDB::Env.allocate is deprecated; use > use_define_alloc_func()

???

svg% ruby -vrbdb -e 'BDB::Hash.open("/tmp/aa", nil, BDB::RDONLY, 0644)'
ruby 1.8.1 (2003-12-25) [i686-linux]
svg%

and this is what i get:

ruby 1.8.0 (2002-12-24) [i686-linux]
/usr/local/lib/ruby/site_ruby/1.8/i686-linux/bdb.so: warning: defining BDB::Env.allocate is deprecated; use rb_define_alloc_func()
/usr/local/lib/ruby/site_ruby/1.8/i686-linux/bdb.so: warning: defining BDB::Common.allocate is deprecated; use rb_define_alloc_func()

Again, the same two messages show up.

Do you have HAVE_RB_DEFINE_ALLOC_FUNC in intern.h (source of ruby) ?

svg% grep HAVE_RB_DEFINE_ALLOC_FUNC ~/ruby/ruby-1.8.1/*.h
/home/ts/ruby/ruby-1.8.1/intern.h:#define HAVE_RB_DEFINE_ALLOC_FUNC 1
svg%

no, no such constant. I tried the following in bdb/src/Makefile

CFLAGS = -fPIC -g -O2 -DHAVE_RB_DEFINE_ALLOC_FUNC

and the compilation is ok, require 'bdb' is ok, but

  BDB::Hash.open(blah-blah-blah)

is not ok, in particular, those two messages dont appear but the object that gets created is nil.

This is a version of bdb compiled with ruby 1.8 ?

I guess so, as seen from the following messages produced in the process of bdb compilation

gcc -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/i686-linux -I/usr/local/lib/ruby/1.8/i686-linux -I. -I/usr/local/BerkeleyDB.4.2/include -c common.c

I used to have ruby 1.6 and its traces may still remain in my OS, but i hope they dont interfere.

Guy Decoux

Nikolai Krot

···

--
Bore, n.:
  A guy who wraps up a two-minute idea in a two-hour vocabulary.
    -- Walter Winchell

ruby 1.8.0 (2002-12-24) [i686-linux]

   ^^^^^^^^^^^^^^^^^^^^^^^

What is this version ? From ftp.ruby-lang.org

ncftp /pub/ruby/1.8 > dir
-rw-rw-r-- 1 root ftp 730858 Aug 4 2003 ChangeLog-1.8.0
-rw-rw-r-- 1 root ftp 14983 Aug 4 2003 changes.1.8.0
-rw-rw-r-- 1 root ftp 1979070 Aug 4 2003 ruby-1.8.0.tar.gz
-rw-rw-r-- 1 root ftp 2671875 Dec 24 2003 ruby-1.8.1.tar.gz
ncftp /pub/ruby/1.8 >

ncftp /pub/ruby/1.6 > dir
-rw-rw-r-- 1 root ftp 819754 Sep 19 2000 ruby-1.6.0.tar.gz
-rw-rw-r-- 1 root ftp 822766 Sep 27 2000 ruby-1.6.1.tar.gz
-rw-rw-r-- 1 root ftp 850897 Dec 25 2000 ruby-1.6.2.tar.gz
-rw-rw-r-- 1 root ftp 850625 Mar 19 2001 ruby-1.6.3.tar.gz
-rw-rw-r-- 1 root ftp 900164 Jun 4 2001 ruby-1.6.4.tar.gz
-rw-rw-r-- 1 root ftp 960496 Sep 19 2001 ruby-1.6.5.tar.gz
-rw-rw-r-- 1 root ftp 976606 Dec 25 2001 ruby-1.6.6.tar.gz
-rw-rw-r-- 1 root ftp 998151 Mar 1 2002 ruby-1.6.7.tar.gz
-rw-rw-r-- 1 root ftp 1023403 Dec 24 2002 ruby-1.6.8.tar.gz
ncftp /pub/ruby/1.6 >

See the date for 1.6.8

no, no such constant. I tried the following in bdb/src/Makefile

CFLAGS = -fPIC -g -O2 -DHAVE_RB_DEFINE_ALLOC_FUNC

This is useless, if it's not defined in intern.h this mean that you don't
have the right version for the include

I used to have ruby 1.6 and its traces may still remain in my OS, but i
hope they dont interfere.

They interfer

Guy Decoux

Thank you.

I have been doing rubying for 2 days and dont yet know about ruby evolution. I took this version from my company's server and never wondered how it had got there. It carries 1.8.0 in its name and is actually timestamped 2002-12-24.

I will try out 1.8.1 from the ftp repository you pointed out. Thanks again.

Best regards
Nikolai Krot

ts wrote:

···

"N" == Nikolai Krot <fake_address@microsoft.com> writes:

> ruby 1.8.0 (2002-12-24) [i686-linux]
   ^^^^^^^^^^^^^^^^^^^^^^^

What is this version ? From ftp.ruby-lang.org