[英]ocaml llvm kaleidoscope tutorial "Unbound module LlvmExecutionEngine"
我切換到我的 mac 並且不再有這個問題,但有一個類似的問題。 OCaml llvm“未綁定模塊執行引擎”
我正在嘗試讓它工作: 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.
首先嘗試編譯
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,它會自動安裝它。然后它會自動運行這段代碼)
然后我編譯你的代碼:
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.