Я пытаюсь использовать ocamlfind для установки library. Я использую OCamlMakeFile. Вот мой Makefile:OCAMlfind local library unbound module
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)
Итак, в основном библиотека представляет собой набор модулей, которые я хочу распространять. Основное использование библиотеки (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
Я скомпилирую библиотеку, просто запустив «make». Он генерирует три файла: «owebl.a, owebl.cma, owebl.cmxa». Затем я установить библиотеку с помощью ocamlfind:
ocamlfind install owebl META owebl.a owebl.cma owebl.cmxa
О, метафайл:
version = "0.1"
name = "OWebl"
description = "A Web Framework for OCaml"
archive(byte) = "owebl.cma"
archive(native) = "owebl.cmxa"
requires = "unix,str"
Все работает, пока я пытаюсь скомпилировать приведенный выше пример, который использует библиотеку. Я бегу:
ocamlbuild -use-ocamlfind -pkgs owebl main.native
И я получаю:
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 with code 2.
Hint: Recursive traversal of subdirectories was not enabled for this build,
as the working directory does not look like an ocamlbuild project (no
'_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
you should add the option "-r" or create an empty '_tags' file.
To enable recursive traversal for some subdirectories only, you can use the
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
Я попытался добавить open Owebl
к началу main.ml, но я только что получил "несвязанного модуль Owebl" аналогично. Я довольно потерял, почему все эти модули не связаны. Что мне не хватает?