caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] ANNOUNCE: Wiki software written in OCaml
       [not found]                 ` <20040730120320.GA813@pegasos>
@ 2004-07-30 16:01                   ` Richard Jones
  2004-07-31 10:22                     ` Sven Luther
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2004-07-30 16:01 UTC (permalink / raw)
  To: Sven Luther; +Cc: caml-list

On Fri, Jul 30, 2004 at 02:03:20PM +0200, Sven Luther wrote:
> Mmm, i adapted it to ocaml 3.08, and added the missing ocamldbi
> build-dependency, since it failed somehow because of a double -I in the
> Makefile.
> 
> Now, it fails with :
> 
> ocamlc -linkall -custom -g -w s -I /usr/lib/ocaml/3.08/pcre -I
> /usr/lib/ocaml/3.08/dbi -I /usr/include/apache-1.3 -I
> /usr/lib/ocaml/3.08/postgres postgres.cma dynlink.cma str.cma pcre.cma
> unix.cma dbi.cma mod_caml_c.o mod_caml.cmo apache_c.o wrappers.o apache.cmo
> mod_caml_config.cmo cgi_escape.cmo template.cmo cgi.cmo -o mod_caml.so \
>   -cclib "-fPIC -shared -L/usr/lib/ocaml/3.08/postgres -lpostgres -lpq
>   -lcamlrun -ltermcap -lunix -lstr "
>   Error while linking /usr/lib/ocaml/3.08/dbi/dbi.cma(Dbi_mysql):
>   Reference to undefined global `Mysql'
>   make[1]: *** [mod_caml.so] Erreur 2

Yes, this is interesting ...

It's because Dbi is built (by John) with MySQL support.  Thus
/usr/lib/ocaml/*/dbi/dbi.cma contains a module (Dbi_mysql) which
depends on (the OCaml module) Mysql.

John's libdbi-ocaml package suggests libmysql-ocaml-dev, but doesn't
require it.  This works fine provided you're just linking a standalone
program against the Dbi library, because unless the standalone program
deliberately links against Dbi_mysql, nothing will attempt to load the
missing Mysql module.

So far, so good.  Now here's the problem: ocamldbi contains a
mechanism to build handles of any type (Dbi.Factory.connect "postgres"
"store") for example, which is implemented using a complex
registration mechanism.  mod_caml requires this, because it provides a
way to pool database handles between requests.

Dbi.Factory loads any available module, depending on how it was
compiled.  Thus when you link mod_caml, and if ocamldbi was compiled
to depend on Mysql, then mod_caml depends on Mysql too!

So the upshot is that libmysql-ocaml-dev is a real dependency, not
just a 'Suggest:'ion.

-----

I'm not really sure how to solve properly this at the moment.

This was all written before I really understood functors.  I suspect
that a functorized approach would be much better, because it is highly
unlikely that you really want a pool of database handles pointing to
different _types_ of database (ie. a mixture of PostgreSQL and MySQL
handles).  (If you did want this, just use two pools, and manage it
yourself).

Suggestions welcome ...

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes,
trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/

-------------------
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] 3+ messages in thread

* Re: [Caml-list] ANNOUNCE: Wiki software written in OCaml
  2004-07-30 16:01                   ` [Caml-list] ANNOUNCE: Wiki software written in OCaml Richard Jones
@ 2004-07-31 10:22                     ` Sven Luther
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Luther @ 2004-07-31 10:22 UTC (permalink / raw)
  To: Richard Jones; +Cc: Sven Luther, caml-list

On Fri, Jul 30, 2004 at 05:01:16PM +0100, Richard Jones wrote:
> On Fri, Jul 30, 2004 at 02:03:20PM +0200, Sven Luther wrote:
> > Mmm, i adapted it to ocaml 3.08, and added the missing ocamldbi
> > build-dependency, since it failed somehow because of a double -I in the
> > Makefile.
> > 
> > Now, it fails with :
> > 
> > ocamlc -linkall -custom -g -w s -I /usr/lib/ocaml/3.08/pcre -I
> > /usr/lib/ocaml/3.08/dbi -I /usr/include/apache-1.3 -I
> > /usr/lib/ocaml/3.08/postgres postgres.cma dynlink.cma str.cma pcre.cma
> > unix.cma dbi.cma mod_caml_c.o mod_caml.cmo apache_c.o wrappers.o apache.cmo
> > mod_caml_config.cmo cgi_escape.cmo template.cmo cgi.cmo -o mod_caml.so \
> >   -cclib "-fPIC -shared -L/usr/lib/ocaml/3.08/postgres -lpostgres -lpq
> >   -lcamlrun -ltermcap -lunix -lstr "
> >   Error while linking /usr/lib/ocaml/3.08/dbi/dbi.cma(Dbi_mysql):
> >   Reference to undefined global `Mysql'
> >   make[1]: *** [mod_caml.so] Erreur 2
> 
> Yes, this is interesting ...
> 
> It's because Dbi is built (by John) with MySQL support.  Thus
> /usr/lib/ocaml/*/dbi/dbi.cma contains a module (Dbi_mysql) which
> depends on (the OCaml module) Mysql.
> 
> John's libdbi-ocaml package suggests libmysql-ocaml-dev, but doesn't
> require it.  This works fine provided you're just linking a standalone
> program against the Dbi library, because unless the standalone program
> deliberately links against Dbi_mysql, nothing will attempt to load the
> missing Mysql module.
> 
> So far, so good.  Now here's the problem: ocamldbi contains a
> mechanism to build handles of any type (Dbi.Factory.connect "postgres"
> "store") for example, which is implemented using a complex
> registration mechanism.  mod_caml requires this, because it provides a
> way to pool database handles between requests.
> 
> Dbi.Factory loads any available module, depending on how it was
> compiled.  Thus when you link mod_caml, and if ocamldbi was compiled
> to depend on Mysql, then mod_caml depends on Mysql too!
> 
> So the upshot is that libmysql-ocaml-dev is a real dependency, not
> just a 'Suggest:'ion.

Well, the problem still happens with libmysql-ocaml-dev installed though,
which is what i find strange.

Friendly,

Sven Luther

-------------------
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] 3+ messages in thread

* [Caml-list] ANNOUNCE: Wiki software written in OCaml
@ 2004-07-29 16:07 Richard Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Jones @ 2004-07-29 16:07 UTC (permalink / raw)
  To: caml-list

Hi:

I wrote a Wiki in OCaml.  It took me two days, and was done solely
because I needed a Wiki for an OCaml project, and it would be nice to
have a Wiki actually written in OCaml.  In other words, complete wheel
reinvention :-)

You can download source (GPL) here:

http://sandbox.merjis.com/_dist/

You can play with the Wiki here:

http://sandbox.merjis.com/

Enjoy ...

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
"One serious obstacle to the adoption of good programming languages is
the notion that everything has to be sacrificed for speed. In computer
languages as in life, speed kills." -- Mike Vanier

-------------------
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] 3+ messages in thread

end of thread, other threads:[~2004-07-31 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20040730005349.GA18722@pegasos>
     [not found] ` <20040730075621.GA5996@annexia.org>
     [not found]   ` <20040730080245.GA6075@annexia.org>
     [not found]     ` <20040730082701.GA30962@pegasos>
     [not found]       ` <20040730084658.GA6898@annexia.org>
     [not found]         ` <20040730090617.GA31469@pegasos>
     [not found]           ` <20040730090647.GA7218@annexia.org>
     [not found]             ` <20040730091939.GA31646@pegasos>
     [not found]               ` <20040730092349.GA7444@annexia.org>
     [not found]                 ` <20040730120320.GA813@pegasos>
2004-07-30 16:01                   ` [Caml-list] ANNOUNCE: Wiki software written in OCaml Richard Jones
2004-07-31 10:22                     ` Sven Luther
2004-07-29 16:07 Richard Jones

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