ocaml - OCamlfind local library unbound module -
i trying use ocamlfind install library. using ocamlmakefile. here makefile:
ocamlmakefile = ocamlmakefile result = owebl sources = src/utils.ml src/verb.ml src/request.ml src/template.ml src/response.ml src/rule.ml src/handler.ml src/server.ml packs = unix str all: native-code-library byte-code-library install: libinstall uninstall: libuninstall include $(ocamlmakefile)
so library collection of modules want distribute. basic usage of library (main.ml):
open response open rule open verb open server let handler = handler.create (staticrouterule.create "/" [get]) (fileresponse.create ~static_file:(fileresponse.staticfile "/index.html") ()) let server = server.create "0.0.0.0" 8080 [handler];; server#serve
i compile library running "make". generates 3 files: "owebl.a, owebl.cma, owebl.cmxa". install library using ocamlfind:
ocamlfind install owebl meta owebl.a owebl.cma owebl.cmxa
oh, meta file is:
version = "0.1" name = "owebl" description = "a web framework ocaml" archive(byte) = "owebl.cma" archive(native) = "owebl.cmxa" requires = "unix,str"
everything works until try compile above example uses library. run:
ocamlbuild -use-ocamlfind -pkgs owebl main.native
and get:
ocamlbuild -use-ocamlfind -pkgs owebl main.native + ocamlfind ocamlc -c -package owebl -o main.cmo main.ml file "main.ml", line 1, characters 5-10: error: unbound module owebl command exited code 2. hint: recursive traversal of subdirectories not enabled build, working directory not ocamlbuild project (no '_tags' or 'myocamlbuild.ml' file). if have modules in subdirectories, should add option "-r" or create empty '_tags' file. enable recursive traversal subdirectories only, can use following '_tags' file: true: -traverse <dir1> or <dir2>: traverse compilation unsuccessful after building 2 targets (1 cached) in 00:00:00. make: *** [fileserver] error 10
i tried adding open owebl
beginning of main.ml got "unbound module owebl" similarly. i'm pretty lost why these modules unbound. missing?
you should use lib_pack_name
variable if want pack modules under umbrella namespace, owebl
, otherwise available is, e.g. response
, rule
, etc. also, should specify mli
files ml
files in sources
variable. , finally, shouldn't forget install cmi
files, .a
files. installing mli
files considered tradition, although not strictly required. also, consider using ocamlmakefile
installation facilities instead of custom installation script.
Comments
Post a Comment