简体   繁体   English

(Ocaml)错误:未绑定的模块Ocamlbuild_pack.Ocamlbuild_Myocamlbuild_config

[英](Ocaml) Error: Unbound module Ocamlbuild_pack.Ocamlbuild_Myocamlbuild_config

i am trying to compile a ocaml program (part of it shown below) 我正在尝试编译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

the last line is causing unbound module error. 最后一行导致未绑定的模块错误。 What can i do? 我能做什么? thanks 谢谢

update 1: 更新1:

The code is from a github project https://github.com/ykazakov/cb-reasoner 该代码来自github项目https://github.com/ykazakov/cb-reasoner

And i am following an instruction there to use "make" to compile the program .. this make file looks like this 而且我正在按照一条指令使用“ 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

I answered this question on the ocamlbuild issue tracker (I follow StackOverflow but less closely, sorry). 在ocamlbuild问题跟踪器上回答了这个问题(我关注StackOverflow,但不太紧密,对不起)。 Quoting below for convenience: 为方便起见,在下面引用:

OCamlbuild exports a stable interface for plugin users as the Ocamlbuild_plugin module. OCamlbuild将稳定的接口导出为插件用户,作为Ocamlbuild_plugin模块。 Using Ocamlbuild_pack directly accesses ocamlbuild's internal definitions, and is recommended against as there are no guarantees of backward-compatibility. 使用Ocamlbuild_pack直接访问ocamlbuild的内部定义,因此建议不要这样做,因为不能保证向后兼容。

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). 在您的特定情况下,此代码使用的模块实际上已在较新的ocamlbuild版本中删除(其存在是ocamlbuild的构建系统集成到编译器发行版中的特定方式的构件)。 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. 我可以使用OCaml 3.12.1、4.00.1和4.01.0正确构建此软件,但不能使用OCaml和ocamlbuild的任何更新版本。

Using opam makes it easy to install old OCaml versions: 使用opam可以轻松安装旧的OCaml版本:

 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. 如果您有兴趣修补此软件以使其与最新的OCaml版本兼容,我们可以讨论如何以更可靠的方式获取相应的信息。

In any case, I'm closing this as it is not a problem of ocamlbuild, but rather a maintenance question for cb-reasoner. 无论如何,我要关闭它,因为这不是ocamlbuild的问题,而是cb-reasoner的维护问题。 (Of course, feel free to post further comments.) (当然,请随时发表进一步的评论。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM