[LLVMdev] ocaml bindings + ocamlbuild problem
Nicolas Ojeda Bar
nojb at math.harvard.edu
Sun Jun 27 09:19:17 PDT 2010
Hello,
I'm trying to use Llvm_bitwriter + ocamlbuild, but it doesn't
recognize its dependency on Unix, so it doesn't compile. Minimal
case:
(* FILE: minimal.ml *)
let main () =
let m = Llvm.create_module (Llvm.global_context ()) "test" in
ignore (Llvm_bitwriter.output_bitcode stdout m)
;;
main ()
(* FILE: _tags *)
<*.{byte,native}>: g++, use_unix, use_llvm, use_llvm_bitwriter
(* FILE: myocamlbuild.ml *)
open Ocamlbuild_plugin;;
ocaml_lib ~extern:true "llvm";;
ocaml_lib ~extern:true "llvm_bitwriter";;
flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
I try to compile with the command line
ocamlbuild minimal.native
and get the result:
Finished, 1 target (0 cached) in 00:00:02.
+ /usr/local/bin/ocamlopt.opt llvm.cmxa llvm_bitwriter.cmxa -cc g++ unix.cmxa minimal.cmx -o minimal.native
File "_none_", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Unix referenced from /usr/local/lib/ocaml/llvm_bitwriter.cmxa(Llvm_bitwriter)
Command exited with code 2.
Compilation unsuccessful after building 4 targets (0 cached) in 00:00:01.
(note that unix.cmxa appears after llvm_bitwriter.cmxa). However, if I try
ocamlopt.opt -cc g++ unix.cmxa llvm.cmxa llvm_bitwriter.cmxa minimal.ml
it compiles fine (note that unix.cmxa is now listed BEFORE llvm_bitwriter.cmxa).
Is there any way to force unix.cmxa be put first in the compilation
command line? I would really prefer not to have to write a Makefile...
Thanks!
N
More information about the llvm-dev
mailing list