[racket] (sqlite3-connect) does not survive "raco distribute" on Windows, saying "sqlite3_open: implementation not found"

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Sep 13 13:20:55 EDT 2013

That's the right idea, but the "libsqlite3" is also needed for Mac OS X
PPC.

I think that 

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

is probably best, along the same lines as `openssl/libcrypto`.

At Fri, 13 Sep 2013 13:17:27 -0400, Ryan Culpepper wrote:
> I've pushed what I believe is a fix. I think the issue is that raco 
> distribute needs to bundle the Racket copy of sqlite3.dll on Windows, 
> since it's not a system library. Here's the code:
> 
> ;; On Windows, raco distribute should include the local sqlite3.dll;
> ;; other platforms have libsqlite3 as system library.
> (define-runtime-path-list _sqlite-libs-for-distribute
>    (case (system-type)
>      [(windows) '((so "sqlite3.dll"))]
>      [else '()]))
> 
> Matthew: does that look right and safe for cross-platform zo compilation?
> 
> Ryan
> 
> 
> On 09/13/2013 12:13 PM, Dmitry Pavlov wrote:
> > Hello,
> >
> > [I actually filed a bug report, but have not received
> > a confirmation, and decided to write here as well.]
> >
> > A program does a call to (sqlite3-connect). The program works well
> > itself, and it works well after being translated into an executable
> > by "raco exe", but "raco distribute" breaks it.
> >
> > The bug reproduces only on Windows; on Linux everything works fine.
> >
> >
> > File mytable.rkt:
> >
> > #lang racket
> >
> > (require db)
> > (define path "mytable.db")
> >
> > (when (file-exists? path)
> >    (delete-directory/files path))
> >
> > (define conn (sqlite3-connect #:database path #:mode 'create))
> > (query-exec conn "create table MYTABLE (n integer primary key)")
> > (disconnect conn)
> > (printf "OK\n")
> >
> >
> > Steps to reproduce:
> >
> > C:\Documents and Settings\dpavlov>raco exe mytable.rkt
> >
> > C:\Documents and Settings\dpavlov>mytable.exe
> > OK
> >
> > C:\Documents and Settings\dpavlov>raco distribute mytable-distr mytable.exe
> >
> > C:\Documents and Settings\dpavlov>mytable-distr\mytable.exe
> > sqlite3_open: implementation not found; arguments: #"C:\\Documents and
> > Settings\\dpavlov\\mytable.db" 6
> >    context...:
> >     c:\program files\racket\collects\db\private\sqlite3\main.rkt:11:0:
> > sqlite3-connect13
> >     #%mzc:mytable: [running body]
> >     loop
> >
> >
> > Regards,
> >
> > Dmitry
> >
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users

Posted on the users mailing list.