2

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.
Community
  • 1
  • 1
Bren
  • 3,516
  • 11
  • 41
  • 73
  • The error message says "Unbound module LlvmExecutionEngine", but you open LLvm_executionengine. One of them should be wrong. – camlspotter May 05 '16 at 18:20
  • @camlspotter i thought this was just weird name issue. Do you have nay other advice for me because I'm very confused what the issue is then if as you pointed out the error doesn't match the open call. – Bren May 05 '16 at 19:15
  • @Bren Are you sure you're looking at the right file? Maybe you're looking at the toplevel.ml in one directory, but ocamlfind is compiling the toplevel.ml in another directory, where it says `open LlvmExecutionengine`. – sepp2k May 05 '16 at 20:42
  • @sepp2k just double checked. its the right now. – Bren May 05 '16 at 21:23

1 Answers1

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
tobiasBora
  • 1,542
  • 14
  • 23
  • Tried the first line now trying the second. The switch line is complaining for some reason. gives this error $ opam switch 4.03.0 [ERROR] "4.03.0" is not a valid compiler. – Bren May 05 '16 at 21:24
  • The result of the first line is at the bottom of my answer. – Bren May 05 '16 at 21:49
  • I didn't use the same filename as you, change test.byte with toy.byte. – tobiasBora May 05 '16 at 22:28
  • For opam, could you please run "opam update", and then "opam switch 4.03.0", and if you still have a problem give the result of "opam switch list". – tobiasBora May 05 '16 at 22:31