I installed llvm module with opam install llvm
, and checked the libraries are correctly created. However, when I tried to use it I got Error: Unbound module Llvm
error.
a@prosseek Chapter3> ocaml llvm.cma
Cannot find file llvm.cma.
What might be wrong?
EDIT1
This is what I get from executing commands in command line.
a@prosseek Chapter4> eval `opam config env`
a@prosseek Chapter4> opam install llvm
[NOTE] Package llvm is already installed (current version is 3.2).
a@prosseek Chapter4> ocaml
OCaml version 4.01.0
# #require "llvm";;
Unknown directive `require'.
# open Llvm;;
Error: Unbound module Llvm
From http://projects.camlcity.org/projects/dl/findlib-1.3.1/doc/guide-html/quickstart.html.
# #use "topfind";;
- : unit = ()
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads
- : unit = ()
# #require "llvm";;
/Users/smcho/.opam/system/lib/llvm/.: added to search path
# #require "llvm";;system/lib/llvm/./llvm.cma: loaded
Error: The external function `llvm_global_succ' is not available
Edit2
From llvm OCaml bindings
cd /Users/smcho/.opam/system/lib/llvm
a@prosseek llvm> ocamlfind ocamlmktop -o llvmtop -thread -linkpkg -package llvm llvm.cma -cc g++
File "llvm.cma(Llvm)", line 1:
Warning 31: files llvm.cma(Llvm) and /Users/smcho/.opam/system/lib/llvm/./llvm.cma(Llvm) both define a module named Llvm
a@prosseek llvm> llvmtop
OCaml version 4.01.0
# #use "topfind";;
to enable threads
- : unit = ()
# #require "llvm";;
/Users/smcho/.opam/system/lib/llvm/.: added to search path
/Users/smcho/.opam/system/lib/llvm/./llvm.cma: loaded
# open Llvm;;
However, I'm not sure how I can make it work with with ocaml
, not with llvmtop
. This site has the information about top loop - http://projects.camlcity.org/projects/dl/findlib-1.3.1/doc/guide-html/quickstart.html
I'm confused by symbols
Chapter3>
in your code. Where did you get it? Is it some kind of top-level? General procedure of loading modules into toplevel is:Update Custom toplevel contains some C functions which are not loaded into default OCaml toplevel. They are linked into it. I think if you add
-verbose
option toocamlfind
invocation you will see some LLVM-specific linking options.