ocaml llvm kaleidoscope tutorial “Unbound module LlvmExecutionEngine”

大兔子大兔子 提交于 2019-12-10 23:59:40

问题


I switched to my mac and no longer have this issue but have a similar one. OCaml llvm "Unbound module ExecutionEngine"

I'm trying to get this to work: https://github.com/llvm-mirror/llvm/tree/master/examples/OCaml-Kaleidoscope/Chapter7

from this tutorial http://llvm.org/docs/tutorial/OCamlLangImpl7.html

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

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

Any help would be super!

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.

回答1:


First try to compile with

ocamlbuild -use-ocamlfind toy.byte -package llvm

(please note that I removed the "llvm_executionengine" from your example)

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

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 )

Then I compile your code with :

ocamlbuild -use-ocamlfind toy.byte -package llvm

(please note that I removed the "llvm_executionengine" in your example)

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


来源:https://stackoverflow.com/questions/37057189/ocaml-llvm-kaleidoscope-tutorial-unbound-module-llvmexecutionengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!