Skip to content

Instantly share code, notes, and snippets.



Created Apr 15, 2015
What would you like to do?
<*.{byte,native}>: g++, use_llvm, use_llvm_analysis
~/llvm_test[]> ocamlbuild toy.byte
Finished, 0 targets (0 cached) in 00:00:00.
+ /Users/cateches/.opam/4.02.0+trunk/bin/ocamlc.opt -c -o toy.cmo
File "", line 2, characters 5-9:
Error: Unbound module Llvm
Command exited with code 2.
Compilation unsuccessful after building 2 targets (1 cached) in 00:00:00.
(* this is shamelessly copied from *)
open Ocamlbuild_plugin;;
ocaml_lib ~extern:true "llvm";;
ocaml_lib ~extern:true "llvm_analysis";;
flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
open Llvm
let _ =
print_endline "we'll worry about using it later"

This comment has been minimized.

Copy link
Owner Author

@samlecuyer samlecuyer commented Apr 15, 2015

I've tried ocamlbuild -pkg llvm toy.byte but that gives me

+ /Users/cateches/.opam/4.02.0+trunk/bin/ocamlc.opt llvm.cma llvm_analysis.cma -cc g++ -I /Users/cateches/.opam/4.02.0+trunk/lib/llvm/. '-ccopt -lstdc++' llvm.cma toy.cmo -o toy.byte
/Users/cateches/.opam/4.02.0+trunk/bin/ocamlc.opt: unknown option '-ccopt -lstdc++'.

followed by ocamlopt's "usage" listing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment