我切换到我的mac并且不再有这个问题,但有一个类似的问题。 OCaml llvm "Unbound module ExecutionEngine"
我正试图让它发挥作用: https://github.com/llvm-mirror/llvm/tree/master/examples/OCaml-Kaleidoscope/Chapter7
来自本教程 http://llvm.org/docs/tutorial/OCamlLangImpl7.html
(我99%肯定这两个人是同一个人)
在解决了几个问题之后,我已经达到了过去几个小时的绊脚石
me@mypc:~/Desktop/llvm-master/examples/OCaml-Kaleidoscope/Chapter7$ ocamlbuild -use-ocamlfind toy.byte -package llvm llvm_executionengine
Finished, 0 targets (0 cached) in 00:00:00.
File "_tags", line 4, characters 41-53:
Warning: the tag "use_bindings" is not used in any flag declaration, so it will have no effect; it may be a typo. Otherwise use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
+ ocamlfind ocamlc -c -package llvm -o toplevel.cmo toplevel.ml
File "toplevel.ml", line 6, characters 5-24:
Error: Unbound module LlvmExecutionEngine
Command exited with code 2.
Compilation unsuccessful after building 13 targets (12 cached) in 00:00:00.
我很确定llvm_executionengine是正确的包,好像我尝试了别的东西,它说它不知道它是什么包。
以下是带有错误行的前几行代码:
(*===----------------------------------------------------------------------===
* Top-Level parsing and JIT Driver
*===----------------------------------------------------------------------===*)
open Llvm
open Llvm_executionengine
(* top ::= definition | external | expression | ';' *)
let rec main_loop the_fpm the_execution_engine stream =
match Stream.peek stream with
| None -> ()
任何帮助都是超级的!
我尝试了tobiasBora的第一部分答案并得到了这个结果:
$ ocamlbuild -use-ocamlfind test.byte -package llvm
Finished, 0 targets (0 cached) in 00:00:00.
File "_tags", line 4, characters 41-53:
Warning: the tag "use_bindings" is not used in any flag declaration, so it will have no effect; it may be a typo. Otherwise use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
Solver failed:
Ocamlbuild cannot find or build test.ml. A file with such a name would usually be a source file. I suspect you have given a wrong target name to Ocamlbuild.
Compilation unsuccessful after building 0 targets (0 cached) in 00:00:00.
答案 0 :(得分:1)
首先尝试使用
进行编译ocamlbuild -use-ocamlfind toy.byte -package llvm
(请注意我从你的例子中移除了" llvm_executionengine")
如果它仍然不起作用,因为它对我有用,试试这个:首先我正在运行Ocaml 4.03.0:
opam switch 4.03.0
然后我需要安装llvm:
opam depext llvm.3.8
opam install llvm
(如果未安装depext,它会自动安装它。然后它将自动运行此code )
然后我用:
编译你的代码ocamlbuild -use-ocamlfind toy.byte -package llvm
(请注意我已删除" llvm_executionengine"在您的示例中)
你可以注意到一个错误使llvm 3.8在旧版本的ocaml中无法使用。如果您仍有问题,请尝试安装3.5版本,它可能会解决一些问题:
sudo apt-get install llvm-3.5 llvm-3.5-dev