(Ocaml) Error: Unbound module Ocamlbuild_pack.Ocamlbuild_Myocamlbuild_config
(Ocaml) Error: Unbound module Ocamlbuild_pack.Ocamlbuild_Myocamlbuild_config
我正在尝试编译一个 ocaml 程序(部分如下所示)
open Ocamlbuild_plugin
open Command
(** helper functions )
( splitting strings using a delimeter character *)
let rec strsplit sep str accu len =
try let idx = String.rindex_from str (len - 1) sep in
strsplit sep str ((String.sub str (idx + 1) (len - 1 - idx)) :: accu) idx
with Not_found -> (String.sub str 0 len) :: accu
let strsplit sep str = strsplit sep str [] (String.length str)
(** initializing variables from the environment *)
let host = Ocamlbuild_pack.Ocamlbuild_Myocamlbuild_config.system
最后一行导致未绑定模块错误。我能做什么?谢谢
更新 1:
代码来自 github 项目 https://github.com/ykazakov/cb-reasoner
我正在按照那里的说明使用 "make" 编译程序.. 这个 make 文件看起来像这样
BUILDDIR ?= _build
OCAMLBUILD ?= ocamlbuild
OCAMLBUILD := $(OCAMLBUILD) -build-dir $(BUILDDIR)
.PHONY: main clean clib
main:
$(OCAMLBUILD) main/cb.native
all:
$(OCAMLBUILD) main/cb.native jni cwrap/libcb.a
cwrap:
$(OCAMLBUILD) cwrap/libcb.a
jni:
$(OCAMLBUILD) jni
clean:
$(OCAMLBUILD) -clean;\
rm -f cb.native
我在 the ocamlbuild issue tracker 上回答了这个问题(我关注 Whosebug,但不太关注,抱歉)。为方便起见,在下面引用:
OCamlbuild exports a stable interface for plugin users as the Ocamlbuild_plugin
module. Using Ocamlbuild_pack
directly accesses ocamlbuild's internal definitions, and is recommended against as there are no guarantees of backward-compatibility.
In your specific case, a module is used by this code that indeed was removed in more recent ocamlbuild versions (its presence was an artifact of the specific way ocamlbuild's build system was integrated into the compiler distribution). I could correctly build this software with OCaml 3.12.1, 4.00.1 and 4.01.0, but not any more recent version of OCaml and ocamlbuild.
Using opam
makes it easy to install old OCaml versions:
opam install 4.01.0
eval $(opam env --switch=4.01.0)
make # if in the project's directoyr
If you are interested in patching this software to make it compatible with more recent OCaml versions, we could discuss how to get the corresponding information in a more robust way.
In any case, I'm closing this as it is not a problem of ocamlbuild, but rather a maintenance question for cb-reasoner. (Of course, feel free to post further comments.)
我正在尝试编译一个 ocaml 程序(部分如下所示)
open Ocamlbuild_plugin
open Command
(** helper functions )
( splitting strings using a delimeter character *)
let rec strsplit sep str accu len =
try let idx = String.rindex_from str (len - 1) sep in
strsplit sep str ((String.sub str (idx + 1) (len - 1 - idx)) :: accu) idx
with Not_found -> (String.sub str 0 len) :: accu
let strsplit sep str = strsplit sep str [] (String.length str)
(** initializing variables from the environment *)
let host = Ocamlbuild_pack.Ocamlbuild_Myocamlbuild_config.system
最后一行导致未绑定模块错误。我能做什么?谢谢
更新 1:
代码来自 github 项目 https://github.com/ykazakov/cb-reasoner
我正在按照那里的说明使用 "make" 编译程序.. 这个 make 文件看起来像这样
BUILDDIR ?= _build
OCAMLBUILD ?= ocamlbuild
OCAMLBUILD := $(OCAMLBUILD) -build-dir $(BUILDDIR)
.PHONY: main clean clib
main:
$(OCAMLBUILD) main/cb.native
all:
$(OCAMLBUILD) main/cb.native jni cwrap/libcb.a
cwrap:
$(OCAMLBUILD) cwrap/libcb.a
jni:
$(OCAMLBUILD) jni
clean:
$(OCAMLBUILD) -clean;\
rm -f cb.native
我在 the ocamlbuild issue tracker 上回答了这个问题(我关注 Whosebug,但不太关注,抱歉)。为方便起见,在下面引用:
OCamlbuild exports a stable interface for plugin users as the
Ocamlbuild_plugin
module. UsingOcamlbuild_pack
directly accesses ocamlbuild's internal definitions, and is recommended against as there are no guarantees of backward-compatibility.In your specific case, a module is used by this code that indeed was removed in more recent ocamlbuild versions (its presence was an artifact of the specific way ocamlbuild's build system was integrated into the compiler distribution). I could correctly build this software with OCaml 3.12.1, 4.00.1 and 4.01.0, but not any more recent version of OCaml and ocamlbuild.
Using
opam
makes it easy to install old OCaml versions:opam install 4.01.0 eval $(opam env --switch=4.01.0) make # if in the project's directoyr
If you are interested in patching this software to make it compatible with more recent OCaml versions, we could discuss how to get the corresponding information in a more robust way.
In any case, I'm closing this as it is not a problem of ocamlbuild, but rather a maintenance question for cb-reasoner. (Of course, feel free to post further comments.)