Weiss Zucker
Weiss Zucker

Reputation: 89

Compilation error with sexplib

I need to use Sexplib in my program. I tried

ocamlc sexplib.cma prog.ml
Error: Unbound module Sexplib

and I got the error. But I can use Sexplib in top level if I load ppx_sexp_conv package first:

#require "ppx_sexp_conv";;
open Sexplib;;

So I also tried this:

ocamlfind ocamlc -package ppx_sexp_conv sexplib.cma prog.ml
Error: Error while linking /Users/neko/.opam/system/lib/sexplib/sexplib.cma(Sexplib):
The external function `caml_ba_get_1' is not available

I have no idea what this means and what I need to do now... Can anyone help?

Upvotes: 0

Views: 333

Answers (2)

Étienne Millon
Étienne Millon

Reputation: 3028

The linker is missing C externals used by your package. You should be able to fix this by passing -linkpkg to ocamlfind so that it passes the relevant arguments to the linker:

ocamlc -package ppx_sexp_conv -linkpkg prog.ml

Upvotes: 0

Jeffrey Scofield
Jeffrey Scofield

Reputation: 66823

caml_ba_get_1 is a function of the Bigarray module. You might try linking in the bigarray package (or bigarray.cma). On my system the function is defined in libbigarray.a.

Upvotes: 0

Related Questions