简体   繁体   English

ocaml llvm 万花筒教程《未绑定模块 LlvmExecutionEngine》

[英]ocaml llvm kaleidoscope tutorial "Unbound module LlvmExecutionEngine"

I switched to my mac and no longer have this issue but have a similar one.我切换到我的 mac 并且不再有这个问题,但有一个类似的问题。 OCaml llvm "Unbound module ExecutionEngine" OCaml llvm“未绑定模块执行引擎”

I'm trying to get this to work: https://github.com/llvm-mirror/llvm/tree/master/examples/OCaml-Kaleidoscope/Chapter7我正在尝试让它工作: https : //github.com/llvm-mirror/llvm/tree/master/examples/OCaml-Kaleidoscope/Chapter7

from this tutorial http://llvm.org/docs/tutorial/OCamlLangImpl7.html从本教程http://llvm.org/docs/tutorial/OCamlLangImpl7.html

(I'm 99% sure these two are by the same people) (我 99% 确定这两个是同一个人)

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.

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.我很确定 llvm_executionengine 是正确的包,就好像我尝试了其他东西一样,它说它不知道它是什么包。

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 -> ()

Any help would be super!任何帮助都会很棒!

I tried the first part of tobiasBora's answer and got this result:我尝试了 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.

First try to compile with首先尝试编译

ocamlbuild -use-ocamlfind toy.byte -package llvm

(please note that I removed the "llvm_executionengine" from your example) (请注意,我从您的示例中删除了“llvm_executionengine”)

If it still doesn't work, since it work for me try this : First i'm running Ocaml 4.03.0 :如果它仍然不起作用,因为它对我有用,请尝试以下操作:首先,我正在运行 Ocaml 4.03.0:

opam switch 4.03.0

and then I need to install llvm :然后我需要安装 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 ) (如果没有安装 depext,它会自动安装它。然后它会自动运行这段代码

Then I compile your code with :然后我编译你的代码:

ocamlbuild -use-ocamlfind toy.byte -package llvm

(please note that I removed the "llvm_executionengine" in your example) (请注意,我在您的示例中删除了“llvm_executionengine”)

You can note that a bug make llvm 3.8 unusable in older versions of ocaml.您可以注意到一个错误使 llvm 3.8 在旧版本的 ocaml 中无法使用。 If you still have problems, please try to install the 3.5 version, it may solve some problems :如果还有问题,请尝试安装3.5版本,可能会解决一些问题:

sudo apt-get install llvm-3.5 llvm-3.5-dev

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

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