caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] DBM in OCaml 3.07
@ 2003-10-15  0:13 Matt Gushee
  2003-10-15  0:40 ` Jacques Garrigue
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Gushee @ 2003-10-15  0:13 UTC (permalink / raw)
  To: caml-list

Hello, all--

I built and installed OCaml 3.07 for the first time yesterday, and
noticed a couple of issues with the Dbm module. First of all, when I ran 
'configure', I got an error message saying that NDBM support was not
available. Now, strictly speaking that is true: I am running Debian
GNU/Linux 3.0 with GDBM, not NDBM. But I had DBM working under OCaml
3.06, and as far as I can remember no special measures were required to
build it.

More specifically, the configure script tests for the existence of
$INCLUDE_PATH/gdbm-ndbm.h; if that file is found, it then tests
'sh ./hasgot -lgdbm_compat -lgdbm dbm_open' (line 1253). This test fails
on my system, since there is no libgdbm_compat.so, and as far as I can 
tell there is no Debian package that provides that library (nor is there
any Debian package providing NDBM--the alternatives to GDBM are packages
called 'libdb2' and 'libdb3'--I haven't tried either, but judging from
the file names in the packages, they aren't intended to be used in place
of NDBM).

Now, I was able to configure and build the Dbm module simply by adding
the lines

  elif sh ./hasgot -lgdbm dbm_open; then
    dbm_link="-lgdbm"

to the configure script, and I seem to have a working Dbm module ... or
do I? I notice I can't open a DBM database in write-only mode, which was
also the case with OCaml 3.06. So I'm wondering if the build was
supposed to fail. 

So I don't know if the configure script needs to be fixed or not. If
not, though, there should probably be some documentation explaining
exactly what libraries and headers are needed for DBM.

The second issue I encountered is that the databases produced by the
3.07 version of Dbm are incompatible with those created under 3.06. E.g.

  $ file /var/lib/fontdb/ttf.db  # old file, created under 3.06
  /var/lib/fontdb/ttf.db: Berkeley DB 1.85 \
    (Hash, version 2, native byte-order)

  $ file /var/tmp/spam.dir       # new files, created under 3.07
  /var/tmp/spam.dir: GNU dbm 1.x or ndbm database, little endian
  $ file /var/tmp/spam.pag 
  /var/tmp/spam.pag: GNU dbm 1.x or ndbm database, little endian
  
Shouldn't there be at least a Changelog entry for this?
      
-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] DBM in OCaml 3.07
  2003-10-15  0:13 [Caml-list] DBM in OCaml 3.07 Matt Gushee
@ 2003-10-15  0:40 ` Jacques Garrigue
  2003-10-15  1:24   ` Matt Gushee
  0 siblings, 1 reply; 5+ messages in thread
From: Jacques Garrigue @ 2003-10-15  0:40 UTC (permalink / raw)
  To: matt; +Cc: caml-list

From: Matt Gushee <matt@gushee.net>

> I built and installed OCaml 3.07 for the first time yesterday, and
> noticed a couple of issues with the Dbm module. First of all, when I ran 
> 'configure', I got an error message saying that NDBM support was not
> available. Now, strictly speaking that is true: I am running Debian
> GNU/Linux 3.0 with GDBM, not NDBM. But I had DBM working under OCaml
> 3.06, and as far as I can remember no special measures were required to
> build it.
[...]
> The second issue I encountered is that the databases produced by the
> 3.07 version of Dbm are incompatible with those created under 3.06. E.g.
> 
>   $ file /var/lib/fontdb/ttf.db  # old file, created under 3.06
>   /var/lib/fontdb/ttf.db: Berkeley DB 1.85 \
>     (Hash, version 2, native byte-order)
> 
>   $ file /var/tmp/spam.dir       # new files, created under 3.07
>   /var/tmp/spam.dir: GNU dbm 1.x or ndbm database, little endian
>   $ file /var/tmp/spam.pag 
>   /var/tmp/spam.pag: GNU dbm 1.x or ndbm database, little endian

This is strange enough: apparently under ocaml 3.06 you were using
Berkeley DB rather than gdbm. This is coherent with the configure
script, which tries Berkeley DB (db1) before gdbm.
Now, for some reason Berkeley DB seems not to work on your system now
(you could try to configure ocaml 3.06 again to see that).
So I think the change is in your system not in ocaml itself.
Did you remove some library?

There seems to be another problem with gdbm-ndbm.h being ignored if
there is no gdbm_compat library, which might have to be fixed, but I'm
no gdbm exert. gdbm-ndbm.h was not checked on ocaml 3.06, but it has
lower priority than ndbm.h anyway.

Jacques Garrigue

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] DBM in OCaml 3.07
  2003-10-15  0:40 ` Jacques Garrigue
@ 2003-10-15  1:24   ` Matt Gushee
  2003-10-15  1:39     ` Jacques Garrigue
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Gushee @ 2003-10-15  1:24 UTC (permalink / raw)
  To: caml-list

On Wed, Oct 15, 2003 at 09:40:48AM +0900, Jacques Garrigue wrote:
> From: Matt Gushee <matt@gushee.net>
> 
> > I built and installed OCaml 3.07 for the first time yesterday, and
> > noticed a couple of issues with the Dbm module. First of all, when I ran 
> > 'configure', I got an error message saying that NDBM support was not
> > available. Now, strictly speaking that is true: I am running Debian

> This is strange enough: apparently under ocaml 3.06 you were using
> Berkeley DB rather than gdbm. This is coherent with the configure
> script, which tries Berkeley DB (db1) before gdbm.
> Now, for some reason Berkeley DB seems not to work on your system now
> (you could try to configure ocaml 3.06 again to see that).
> So I think the change is in your system not in ocaml itself.
> Did you remove some library?

Well, I tinker with my system a lot, so it's possible, but I have no
memory of adding or removing anything relating to DBM, nor can I imagine
why I would have. But I think the problem may be with the configure
script anyway--see below.

> There seems to be another problem with gdbm-ndbm.h being ignored if
> there is no gdbm_compat library, which might have to be fixed, but I'm
> no gdbm exert. gdbm-ndbm.h was not checked on ocaml 3.06, but it has
> lower priority than ndbm.h anyway.

Ah, but it effectively has a *higher* priority in the configure script:

  for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
    if test -f $dir/ndbm.h; then
      ....
    fi
    if test -f $dir/gdbm-ndbm.h; then
      ....
    fi
  done

Since I have both GDBM and NDBM (I hadn't looked hard enough before:
Debian provides NDBM with the libc6 package), the above results in
attempting to use GDBM (as I'm sure you can tell). Perhaps that should
be

  for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
    if test -f $dir/ndbm.h; then
      ....
    elif test -f $dir/gdbm-ndbm.h; then
      ....
    fi
  done

?

And maybe it would be useful to add a -dbm-includes option to the
configure script, to help people work around this sort of situation. I
suspect I'm not the only person with more than one DBM library.

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] DBM in OCaml 3.07
  2003-10-15  1:24   ` Matt Gushee
@ 2003-10-15  1:39     ` Jacques Garrigue
  2003-10-15  2:24       ` Matt Gushee
  0 siblings, 1 reply; 5+ messages in thread
From: Jacques Garrigue @ 2003-10-15  1:39 UTC (permalink / raw)
  To: matt; +Cc: caml-list

From: Matt Gushee <matt@gushee.net>

> > There seems to be another problem with gdbm-ndbm.h being ignored if
> > there is no gdbm_compat library, which might have to be fixed, but I'm
> > no gdbm exert. gdbm-ndbm.h was not checked on ocaml 3.06, but it has
> > lower priority than ndbm.h anyway.
> 
> Ah, but it effectively has a *higher* priority in the configure script:
> 
>   for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
>     if test -f $dir/ndbm.h; then
>       ....
        break
>     fi
>     if test -f $dir/gdbm-ndbm.h; then
>       ....
        break
>     fi
>   done

The break is supposed to get out of the loop, so if ndbm.h is in the
same directory, or a previous directory, it has priority.
This is a bit confusing, as if ndbm.h is in /usr/include/db1 and
gdbm-ndbm.h is in /usr/include, then gdbm-ndbm.h will be selected.
Is it your case?

> And maybe it would be useful to add a -dbm-includes option to the
> configure script, to help people work around this sort of situation. I
> suspect I'm not the only person with more than one DBM library.

Probably a good idea indeed.

         Jacques

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] DBM in OCaml 3.07
  2003-10-15  1:39     ` Jacques Garrigue
@ 2003-10-15  2:24       ` Matt Gushee
  0 siblings, 0 replies; 5+ messages in thread
From: Matt Gushee @ 2003-10-15  2:24 UTC (permalink / raw)
  To: caml-list

On Wed, Oct 15, 2003 at 10:39:29AM +0900, Jacques Garrigue wrote:
> From: Matt Gushee <matt@gushee.net>
> 
> > > There seems to be another problem with gdbm-ndbm.h being ignored if
> > > there is no gdbm_compat library, which might have to be fixed, but I'm
> > > no gdbm exert. gdbm-ndbm.h was not checked on ocaml 3.06, but it has
> > > lower priority than ndbm.h anyway.
> > 
> > Ah, but it effectively has a *higher* priority in the configure script:
> > 
> The break is supposed to get out of the loop, so if ndbm.h is in the
> same directory, or a previous directory, it has priority.
> This is a bit confusing, as if ndbm.h is in /usr/include/db1 and
> gdbm-ndbm.h is in /usr/include, then gdbm-ndbm.h will be selected.
> Is it your case?

Yes, that's it exactly. Since it's very hard to anticipate exactly where
header files will be located, maybe it would be better to do two loops,
first searching for ndbm.h in all the directories, then searching for
gdbm-ndbm.h only if ndbm.h was not found. The following code works for
me:

  for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
    if test -f $dir/ndbm.h; then
      dbm_include=$dir
      if sh ./hasgot dbm_open; then
        dbm_link=""
      elif sh ./hasgot -lndbm dbm_open; then
        dbm_link="-lndbm"
      elif sh ./hasgot -ldb1 dbm_open; then
        dbm_link="-ldb1"
      elif sh ./hasgot -lgdbm dbm_open; then
        dbm_link="-lgdbm"
      elif sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
        dbm_link="-lgdbm_compat -lgdbm" 
      fi
      break
    fi
  done
  if [ "$dbm_include" = "not found" ]; then
    for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
      if test -f $dir/gdbm-ndbm.h; then
        dbm_include=$dir
        use_gdbm_ndbm=yes
        if sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
          dbm_link="-lgdbm_compat -lgdbm"
        elif sh ./hasgot -lgdbm dbm_open; then
          dbm_link="-lgdbm"
        fi
        break   
      fi
    done
  fi

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-10-15  2:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15  0:13 [Caml-list] DBM in OCaml 3.07 Matt Gushee
2003-10-15  0:40 ` Jacques Garrigue
2003-10-15  1:24   ` Matt Gushee
2003-10-15  1:39     ` Jacques Garrigue
2003-10-15  2:24       ` Matt Gushee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).