Error with bdb installation

I'm trying to use WordNet, database version, with ruby library. [1]

I'm getting the "error 126" when I try convertdb.rb:

/usr/lib/ruby/site_ruby/1.8/i386-cygwin/bdb.so: dlopen, Win32 error 126 - /usr/lib/ruby/site_ruby/1.8/i386-cygwin/bdb.so (LoadError)

Not surprisingly, bdb.so is there:

% ls -l
total 402
drwxrwxrwx+ 2 crommc mkgroup-l-d 4096 Jan 26 16:40 .
drwxrwxrwx+ 8 crommc mkgroup-l-d 4096 Dec 10 12:36 ..
-rwxr-xr-x 1 crommc mkgroup-l-d 148992 Jan 26 16:39 bdb.so
-rwxr-xr-x 1 crommc mkgroup-l-d 133120 Aug 2 16:21 maxent.so
-rwxr-xr-x 1 crommc mkgroup-l-d 13312 Nov 1 17:29 mod_curia.so
[...]

I read [2] that this was an error in ruby-1.8.1 that should be fixed in
1.8.2, but upgrading Ruby to 1.8.2 didn't change this problem.

Also, in trying to reinstall bdb, I have problems with extconf.rb.
Whatever parameters I give, it says "libdb not found". What is the exact
file it is looking for?

···

----
Footnotes:
[1] <http://www.deveiate.org/code/Ruby-WordNet.html&gt;
[2] http://groups.google.ca/groups?selm=20040812171617.EE6726F0.ocean%40m2.ccsnet.ne.jp
--
Oliver C.
45n31, 73w34
Temperatur: -14°C (-23)

Hi,

Oliver Cromm <lispamateur@internet.uqam.ca> writes:

Also, in trying to reinstall bdb, I have problems with extconf.rb.
Whatever parameters I give, it says "libdb not found". What is the exact
file it is looking for?

You need to install libdb4.2 and libdb4.2-devel with:

  Cygwin Installation

···

--
eban

* WATANABE Hirofumi wrote:

Oliver Cromm <lispamateur@internet.uqam.ca> writes:

Also, in trying to reinstall bdb, I have problems with extconf.rb.
Whatever parameters I give, it says "libdb not found". What is the exact
file it is looking for?

You need to install libdb4.2 and libdb4.2-devel with:

  Cygwin Installation

Thank you; FWIW, I was missing libdb4.2-devel. But reinstalling all
Berkeley-related files didn't help me. Without change:

: $ ./extconf.rb
: ./extconf.rb: Entering directory `src'
: checking for db_version() in -ldb-4.3... no
: checking for db_version_4003() in -ldb-4.3... no
: checking for db_version() in -ldb43... no
: checking for db_version_4003() in -ldb43... no
: checking for db_version() in -ldb-4.2... no
: checking for db_version_4002() in -ldb-4.2... no
: checking for db_version() in -ldb42... no
: checking for db_version_4002() in -ldb42... no
: checking for db_version() in -ldb-4.1... no
[etc]
: extconf.rb:78: libdb not found (RuntimeError)
: from extconf.rb:64:in `catch'
: from extconf.rb:64
: ./extconf.rb: Leaving directory `src'

: $ ls /usr/lib/libdb*
: /usr/lib/libdb-4.2.a
: /usr/lib/libdb-4.2.dll.a
: /usr/lib/libdb-4.2.la
: /usr/lib/libdb.a
: /usr/lib/libdb.dll.a
: /usr/lib/libdb.la
: /usr/lib/libdb_cxx-4.2.a
: /usr/lib/libdb_cxx-4.2.dll.a
: /usr/lib/libdb_cxx-4.2.la
: /usr/lib/libdb_cxx.a
: /usr/lib/libdb_cxx.dll.a
: /usr/lib/libdb_cxx.la

So, again: what exactly is that extconf missing?

I found the following:

: $ tail -18 src/mkmf.log
: "gcc -o conftest -I/cygdrive/c/Documents and Settings/crommc/Desktop/bdb-0.5.4/
: src -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/include -g -O2 conftest.c -L"/usr/
: lib" -L"/usr/lib" -lruby-static -ldb-4.2 -lcrypt "
: gcc: and: No such file or directory
: gcc: Settings/crommc/Desktop/bdb-0.5.4/src: No such file or directory
: conftest.c: In function `t':
: conftest.c:5: error: `db_version_4002' undeclared (first use in this function)
: conftest.c:5: error: (Each undeclared identifier is reported only once
: conftest.c:5: error: for each function it appears in.)
: checked program was:
: /* begin */
:
:
: /*top*/
: int main() { return 0; }
: int t() { void ((*volatile p)()); p = (void ((*)()))db_version_4002; return 0; }
: /* end */

That reminds me of the effect

: $ PATH
: bash:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/d/ruby/bin:/cygdrive
: /c/WINNT/system32:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem:/cygdrive/c/
: PROGRA~1/CA/Common/SCANEN~1:/cygdrive/c/PROGRA~1/CA/eTrust/INOCUL~1:/cygdrive/c/
: Program: No such file or directory
: $ echo PATH
: /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/d/ruby/bin:/cygdrive/c/WINNT/system3
: 2:/cygdrive/c/WINNT:/cygdrive/c/WINNT/System32/Wbem:/cygdrive/c/PROGRA~1/CA/Common/SCANEN~
: 1:/cygdrive/c/PROGRA~1/CA/eTrust/INOCUL~1:/cygdrive/c/Program Files/Microsoft SQL
: Server/80/Tools/BINN:/cygdrive/c/Program Files/Microsoft SQL
: Server/80/Tools/Binn/:.:/cygdrive/c/Program Files/Microsoft Visual
: Studio/Common/Tools/WinNT:/cygdrive/c/Program Files/Microsoft Visual
: Studio/Common/MSDev98/Bin:/cygdrive/c/Program Files/Microsoft Visual
: Studio/Common/Tools:/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/bin

Is extconf (or mkmf) disturbed by the spaces in $PATH?

···

--
Oliver C.
45n31, 73w34
Temperatur: -19°C (-29)

So, again: what exactly is that extconf missing?

What is the result of

  nm /usr/lib/libdb.a | grep db_version

Guy Decoux

While on the topic of Ruby-WordNet, you may want to fix a little bug
in convertdb.rb, line 183:
Where it says
   if (entries % CommitThreshold).nonzero?
it should be
   if (entries % CommitThreshold).zero?
The idea is to have the db commit on every 2000th record, not on every
record _but_ the 2000th ones. I went through a weekend of headaches
before I found that out ;).
You will also get a warning on line 348, where StringScanner#empty? is
obsolete (in favor of #eos?).

* ts wrote:

> So, again: what exactly is that extconf missing?

What is the result of

  nm /usr/lib/libdb.a | grep db_version

0000007c T _db_version
         U _db_version

···

--
Oliver C.
45n31, 73w34
Temperatur: -20°C (-28)

0000007c T _db_version
         U _db_version

and with

   nm /usr/lib/libdb.a | grep db_create

   grep db_version /usr/include/db.h

Guy Decoux

* Claus Spitzer wrote:

While on the topic of Ruby-WordNet, you may want to fix a little bug
in convertdb.rb, line 183:

[...]

Thank you, noted down. The project being urgent, I had to roll my own
meanwhile :frowning:

···

--
Oliver C.
45n31, 73w34
Temperatur: -13°C (-21)

Claus Spitzer wrote:

While on the topic of Ruby-WordNet, you may want to fix a little bug
in convertdb.rb, line 183:
Where it says
   if (entries % CommitThreshold).nonzero?
it should be
   if (entries % CommitThreshold).zero?
The idea is to have the db commit on every 2000th record, not on every
record _but_ the 2000th ones. I went through a weekend of headaches
before I found that out ;).

As I said in the other post, the Ruby-dbd installation went ok at home,
so I could install Ruby-WordNet, after the following detours (let's
collect them :wink:

1. Your above-mentioned patch.

2. I had to reduce CommitThreshold to 1000, before that I got a "cuold
not allocate memory" error, even after closing all other applications.
I have 192 MB on that machine.

3. I couldn't run the tests, because I didn't have Test::Unit::Mock,
although it is supposed to be included in ruby 1.8.2. Not in the cygwin
version, it seems. I could install the latest release after I changed
this line in the install.rb file:

elsif site_libdir !~ Regexp.quote(@version)

to

elsif !site_libdir =~ Regexp.quote(@version)

because it was giving me a "type mismatch: String given" error. Then all
the tests ran ok.

4. I could install the docs after changing all the references to 'css2'
in docs/makedocs.rb to 'html', because there is no css2.rb file in my
RDoc. It would be better to write scripts in a tad more flexible manner.

···

--
Oliver C.

* ts wrote:

> 0000007c T _db_version
> U _db_version

and with

   nm /usr/lib/libdb.a | grep db_create

   grep db_version /usr/include/db.h

: $ nm /usr/lib/libdb.a | grep db_create
: U _db_create
: 0000003a T ___bam_db_create
: 00000039 T ___ham_db_create
: U _db_create
: 0000003a T ___qam_db_create
: U _db_create
: U _db_create
: U _db_create
: U _db_create
: U _db_create
: U ___bam_db_create
: U ___ham_db_create
: U ___qam_db_create
: 00000086 T _db_create
: U _db_create
: U _db_create
: U _db_create
: U _db_create
: U _db_create
: U _db_create
: $ grep db_version /usr/include/db.h
: char *db_version __P((int *, int *, int *));

···

--
Oliver C.
45n31, 73w34
Temperatur: -13°C (-21)

: $ grep db_version /usr/include/db.h
: char *db_version __P((int *, int *, int *));

???

Anyway try it with

uln% diff -u bdb-0.5.4/src/extconf.rb.old bdb-0.5.4/src/extconf.rb
--- bdb-0.5.4/src/extconf.rb.old 2004-11-14 16:30:06.000000000 +0100
+++ bdb-0.5.4/src/extconf.rb 2005-01-28 17:16:26.000000000 +0100
@@ -58,20 +58,26 @@
            ""
         end

+under = if with_config("db-underscore")
+ "_"
+ else
+ ""
+ end

···

+
version = with_config('db-version', "-4.3,43,-4.2,42,-4.1,41,-4.0,-4,40,4,3,2,").split(/,/, -1)
version << "" if version.empty?

catch(:done) do
    version.each do |with_ver|
       if unique != true
- db_version = "db_version" + unique
+ db_version = "#{under}db_version" + unique
         throw :done if have_library("db#{with_ver}", db_version)
       end
       if with_ver != "" && (unique == "" || unique == true)
         /(\d)\.?(\d)?/ =~ with_ver
         major = $1.to_i
         minor = $2.to_i
- db_version = "db_version_" + (1000 * major + minor).to_s
+ db_version = "#{under}db_version_" + (1000 * major + minor).to_s
         throw :done if have_library("db#{with_ver}", db_version)
       end
    end
uln%

and run it with

  ruby extconf.rb --with-db-underscore

I'll try to find a better solution

Guy Decoux

ts wrote:

> : $ grep db_version /usr/include/db.h
> : char *db_version __P((int *, int *, int *));

???

Which says: looks right?

Anyway try it with

[patch]

Thank you for your patience. Today being weekend, I tried the whole
thing at home (instead of ...), and it worked without patch. All your
questions give the same results here, so the problem should be somewhere
else.

···

--
Oliver C.

Thank you for your patience. Today being weekend, I tried the whole
thing at home (instead of ...), and it worked without patch. All your
questions give the same results here, so the problem should be somewhere
else.

yes, you are right : the problem is not in bdb

See [ruby-talk:128548]

I found the following:

: $ tail -18 src/mkmf.log
: "gcc -o conftest -I/cygdrive/c/Documents and Settings/crommc/Desktop/bdb-0.5.4/

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

: src -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/include -g -O2 conftest.c -L"/usr/
: lib" -L"/usr/lib" -lruby-static -ldb-4.2 -lcrypt "
: gcc: and: No such file or directory

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

: gcc: Settings/crommc/Desktop/bdb-0.5.4/src: No such file or directory

Change the name of this directory `Documents and Settings' or put it in
another directory

Guy Decoux