Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

whimper / practical set reconciliation

Probably only raevnos will understand this, so let's hope he reads it:OCaml, being a theoretically pure language (they write papers first and then implement the ideas as features), has the corresponding lack of attention to the small details that make popular languages like Python and Perl nice: the standard library is pretty weak, there's no standardized way for programs to configure/install themselves, and there's no standardized way for installing/registering/linking libraries (though findlib is pretty popular).

These SQLite bindings are broken in that they don't install the .so stub library. I modified the makefile to fix that and now they link ok, but then they segfault if I ever do anything wrong.
After some digging:
(gdb) r
Starting program: /home/martine/oc/ocaml-sqlite/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x10004a00 in raise_sqlite_error (zErrmsg=0x1005af60 "") at sqlite_stubs.c:171
171       raise_with_arg(*caml_named_value("sqlite error"), msg); \

it appears that the exceptions are not getting registered before the C stub tries to use them.
The library includes a .ml file that defines and registers the exceptions:
exception Sqlite_error of string
...
let _ = Callback.register_exception "sqlite error" (Sqlite_error "Registering Callback")

So maybe that code isn't getting ran?

If I use their toplevel, it properly runs my test program and raises an exception.
The .cmxa is linked like this:
ocamlmklib -o sqlite sqlite.cmx sqlite_stubs.o -lsqlite -oc sqlite_stubs -cclib -L.
So I want to think that the .cmx is getting linked in "first", whatever that may mean.
To reproduce this I'm linking with ocamlopt sqlite.cmxa test2.ml, but doing it the "right" way with findlib is equally broken.

Looking around at database wrappers led me to SKS, a PGP keyserver (one of the authors is the guy who did the OCaml Berkeley database wrappers) and to their paper Practical Set Reconciliation, which was tonight's reading. The original paper that provided BASIC-RECON would probably be worth reading, too.
Subscribe

  • blog moved

    As described elsewhere, I've quit LiveJournal. If you're interested in my continuing posts, you should look at one of these (each contains feed…

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • treemaps

    I finally wrote up my recent adventures in treemapping, complete with nifty clickable visualizations.

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 1 comment