Skip to content

Instantly share code, notes, and snippets.

@samlecuyer
Created April 15, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samlecuyer/9385b941efff752634b6 to your computer and use it in GitHub Desktop.
Save samlecuyer/9385b941efff752634b6 to your computer and use it in GitHub Desktop.
<*.{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 toy.ml
File "toy.ml", 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 llvm.org
http://llvm.org/docs/tutorial/OCamlLangImpl3.html#full-code-listing *)
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"
;;
@samlecuyer
Copy link
Author

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