-2

I am working on an Ocsigen example (http://ocsigen.org/tuto/manual/macaque).

I get an error when trying to compile the program, as follows.

File "testDB.ml", line 15, characters 14-81 (end at line 18, character 4):
While finding quotation "table" in a position of "expr":
Available quotation expanders are:
svglist (in a position of expr)
svg (in a position of expr)
html5list (in a position of expr)
html5 (in a position of expr)
xhtmllist (in a position of expr)
xhtml (in a position of expr)

Camlp4: Uncaught exception: Not_found

My code is:

 module Lwt_thread = struct
 include Lwt
 include Lwt_chan
 end
 module Lwt_PGOCaml = PGOCaml_generic.Make(Lwt_thread)
 module Lwt_Query = Query.Make_with_Db(Lwt_thread)(Lwt_PGOCaml)

 let get_db : unit -> unit Lwt_PGOCaml.t Lwt.t =
 let db_handler = ref None in
 fun () ->
   match !db_handler with
      | Some h -> Lwt.return h
      | None -> Lwt_PGOCaml.connect ~database:"testbase" ()

let table = <:table< users (
  login text NOT NULL,
  password text NOT NULL
) >>
..........

I used eliom-destillery to generate the basic files. I used "make" to compile the program.

I've tried many different things and done a google search but I can't figure out the problem. Any hints are greatly appreciated.

  • 3
    I broadly guess you are working on Eliom's graffiti example. I am not an expert of Eliom but table is not a valid p4 quotation of TyXml. You MUST give more details: the libraries you use, your compiler options you give, the code around the line 116, etc. – camlspotter Mar 10 '14 at 02:48
  • @camlspotter Hi, you are exactly right that I am working on the example. I added some more details, and I think the error is related with Camlp4, but I don't how to fix it. Thanks for your help. – user3371897 Mar 10 '14 at 13:54

1 Answers1

0

Generally speaking, the error message indicates that CamlP4 does not know the quotation you used, here table, which is used in your code as <:table< ... >>. The quotations can be added by CamlP4 extensions pa_xxx.cmo (or pa_xxx.cma) modules. Unless you made a typo of the quotation name, you failed to load an extension which provides it to CamlP4.

According to http://ocsigen.org/tuto/manual/macaque , Macaque (or its underlying libraries? I am not sure since I have never used it) provides the quotation table. So you have to instruct CamlP4 to load the corresponding extension. I believe the vanilla eliom-destillery is minimum for the basic eliom programming and does not cover for the extensions for Macaque.

Actually the document http://ocsigen.org/tuto/manual/macaque points out it:

We need to reference macaque in the Makefile :

SERVER_PACKAGE := macaque.syntax

This should be the CamlP4 syntax extension name required for table.

camlspotter
  • 8,990
  • 23
  • 27
  • 1
    Thanks for your help. You are right that I need to reference the macaque in the Makefile. I fixed the problem by adding "SERVER_PACKAGES := macaque.syntax" to my Makefile, instead of "SERVER_PACKAGE := macaque.syntax". Note that there is a "S" missed in the line, and I think this is a typo of the tutorial. – user3371897 Mar 11 '14 at 02:18