[racket] customary sqlite3 binary

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jun 11 04:13:23 EDT 2014

After further investigation, I think that changing the name to
"libsqlite3.so.0" will make things worse, not better.

I see several problems with `define-runtime-path` and 'so paths, which
is how `db` references "libsqlite3.so". The scenario you describe,
however, is one of the few combinations that should work.


I'll work on the various problems with `define-runtime-path`, but since
I'm seeing the source of your problem: If you create a program that has

 (define-runtime-path sqlite-so
   (case (system-type)
     [(windows) '(so "sqlite3")]
     [else '(so "libsqlite3" ("0" #f))]))

is `sqlite-so` the path to your "libsqlite3.so" when running directly?
When running the executable generated by `raco exe`?


Meanwhile, I think I see what you mean about providing full paths and
32-bit versus 64-version issue. If you have more than one Racket
installation with the same version number, then they'll look in the
same "~/.racket/6.0/lib" for libraries. At the moment, I don't have a
better suggestion than configuring your installations to look in
different places, probably by adjusting 'lib-search-dirs in
"config.rktd". More generally, the library search path is intended to
be the way to configure foreign libraries from the outside.


At Wed, 11 Jun 2014 07:43:47 +0100, Matthew Flatt wrote:
> Putting the library in "~/.racket/6.0/lib/" should have worked.
> 
> What if you rename the library "libsqlite3.so.0" (i.e., with an
> explciit version)? It looks like the search path in `raco exe` may have
> the wrong nesting of path search versus version search: paths within
> versions instead of versions within paths.
> 
> At Wed, 11 Jun 2014 10:29:35 +0400, Dmitry Pavlov wrote:
> > Hello,
> > 
> > I use Racket's db module and its sqlite3 interface.
> > 
> > Recently it happened that I need to recompile sqlite3 binary
> > and used a modified version, which is the same as the original
> > one, just with some built-in limits extended.
> > 
> > Now, how do I do that in Racket? Clearly I do not need to modify
> > the db module itself, I just need to feed it another binary
> > than the system-wide one that it would load by default.
> > 
> > I found a way: I have put the modified libsqlite3.so to
> > ~/.racket/6.0/lib/ and it works, but now I have a problem
> > with raco distribute: it is oblivious to the modified
> > binary and would not put it into the distribution.
> > 
> > I would prefer to explicitly specify a path to the binary,
> > especially when it comes to 32bit/64bit and Linux/Windows
> > portability issues.
> > 
> > Is there a way? I see #:get-lib-dirs argument
> > in (ffi-lib), but I also see that sqlite3/ffi.rkt does
> > not provide #:get-lib-dirs when it loads the binary.
> > 
> > 
> > Best regards,
> > 
> > Dmitry
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.