[racket] customary sqlite3 binary

From: Dmitry Pavlov (dpavlov at ipa.nw.ru)
Date: Wed Jun 11 06:48:01 EDT 2014

Matthew,

> 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.

Indeed it works. I made a stupid mistake yesterday, erroneously blamed
raco distribute and raised a false alarm, sorry!

> 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".

It is good enough for me!
I have added the following into etc/config.rktd of my 64-bit Racket directory:
(lib-search-dirs . ("/home/dpavlov/.racket/6.0/lib64/" #f))
and it works.

When I build a 32-bit distribution of my program with
a 32-bit installation of Racket, I will put a similar string
with /lib32/ path into etc/config.rktd of that installation.

So that is OK for now, thank you!

> More generally, the library search path is intended to
> be the way to configure foreign libraries from the outside.

Probably you are right. I have used the following approach for my own
libraries (not sqlite):

(require (for-syntax racket/match)
         ffi/unsafe
         (for-syntax ffi/unsafe)
         racket/runtime-path)

(define-runtime-path libmylib-path
  (match (system-type 'os)
    ('unix
     (match (ctype-sizeof _pointer)
       (4 "../mylib/dist/Release32/GNU-Linux-x86/libmylib.so")
       (8 "../mylib/dist/Release64/GNU-Linux-x86/libmylib.so")))
    ('windows
     (match (ctype-sizeof _pointer)
       (4 "../mylib/Win32/Release/mylib.dll")
       (8 "../mylib/x64/Release/mylib.dll")))))

(define libmylib (ffi-lib libmylib-path))

That approach allowed me not to mess with config.rktd,
but now I have to modify config.rktd anyway, and I will
put there paths to my own libraries.

Best regards,

Dmitry

Posted on the users mailing list.