What is a the right way to configure Dune to build an object file that includes the Batteries library? I have tried the following:
let test () = () let _ = Callback.register "test" test
with the following dune file:
(executable (name test) (modes object) (libraries batteries))
… but I get the following error:
$ dune build test.exe.o ocamlopt test.exe.o (exit 2) (cd _build/default && /home/user/.opam/4.03.0/bin/ocamlopt.opt -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -o test.exe.o -output-complete-obj -I /home/user/.opam/4.03.0/lib/batteries -I /home/user/.opam/4.03.0/lib/bytes -I /home/user/.opam/4.03.0/lib/num -I /home/user/.opam/4.03.0/lib/ocaml/threads /home/user/.opam/4.03.0/lib/ocaml/unix.cmxa /home/user/.opam/4.03.0/lib/ocaml/nums.cmxa /home/user/.opam/4.03.0/lib/ocaml/bigarray.cmxa /home/user/.opam/4.03.0/lib/ocaml/str.cmxa /home/user/.opam/4.03.0/lib/ocaml/threads/threads.cmxa /home/user/.opam/4.03.0/lib/batteries/batteries.cmxa /home/user/.opam/4.03.0/lib/batteries/batteriesThread.cmxa .test.eobjs/test.cmx) ld: fatal error: cannot mix -r with dynamic object //lib/x86_64-linux-gnu/libpthread.so.0 File "caml_startup", line 1: Error: Error during linking
What am I doing wrong?