ocaml llvm kaleidoscope tutorial“Unbound module LlvmExecutionEngine” [英] ocaml llvm kaleidoscope tutorial "Unbound module LlvmExecutionEngine"
问题描述
我切换到我的Mac,不再有这个问题,但有一个类似的。 Ocaml llvm未绑定模块执行引擎
I switched to my mac and no longer have this issue but have a similar one. Ocaml llvm "Unbound module ExecutionEngine"
我尝试让此工作:
https:// github.com/llvm-mirror/llvm/tree/master/examples/OCaml-Kaleidoscope/第7章
从本教程
http://llvm.org/docs/tutorial/OCamlLangImpl7.html
(我99%确定这两个是同一个人)
(I'm 99% sure these two are by the same people)
在遇到几个问题后,我遇到了一个绊脚石最近几小时
After getting around a few issues I have reached a stumbling block for the last few hours of
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是正确的包,如果我尝试别的东西,知道它是什么包。
I'm pretty sure llvm_executionengine is the right package as if I try something else it says it doesn't know what package it is.
以下是顶部几行含有错误行的代码:
Here is the are the top few lines of code with the error line:
(*===----------------------------------------------------------------------===
* 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的第一部分的答案,并得到这个结果:
I tried the first part of tobiasBora's answer and got this result:
$ 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.
推荐答案
首先尝试使用
ocamlbuild -use-ocamlfind toy.byte -package llvm
(请注意,我从您的示例中删除了llvm_executionengine)
(please note that I removed the "llvm_executionengine" from your example)
如果它仍然无法正常工作,尝试这样:首先我运行Ocaml 4.03.0:
If it still doesn't work, since it work for me try this : First i'm running Ocaml 4.03.0 :
opam switch 4.03.0
然后我需要安装llvm:
and then I need to install llvm :
opam depext llvm.3.8
opam install llvm
安装后,系统会自动安装它,然后它会自动运行此代码
)
(If depext isn't installed, it will automatically install it. Then it will automatically run this code )
然后我编译你的代码:
ocamlbuild -use-ocamlfind toy.byte -package llvm
(请注意,我删除了llvm_executionengine )
(please note that I removed the "llvm_executionengine" in your example)
您可以注意到一个错误使得llvm 3.8在ocaml的旧版本中不可用。如果您仍然有问题,请尝试安装3.5版本,它可能会解决一些问题:
You can note that a bug make llvm 3.8 unusable in older versions of ocaml. If you still have problems, please try to install the 3.5 version, it may solve some problems :
sudo apt-get install llvm-3.5 llvm-3.5-dev
这篇关于ocaml llvm kaleidoscope tutorial“Unbound module LlvmExecutionEngine”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!