How to include Z3 in Dune project?

64 Views Asked by At

I've been using ocamlbuild to build my projects, but OCaml has abandoned ocamlbuild so I wanted to dunify my projects. I'm trying to compile a project with the opam Z3 package. However, I'm encountering:

Error: Library "Z3" not found.

when I try to run dune build.

On ocambuild this was done via:

-package z3

I was reading the Dune documentation, but it's unclear what stanza I need to add to my dune files. The libraries and package stanzas do not do it. Do I perhaps need to write something in the <project name>.opam file? How does one link opam libraries to dune generally?

EDIT: I believe it was an issue with switches. ocamlbuild appears to be able to find the binaries for z3 using ocamlfind, whereas dune needs z3 installed in the right place. For completeness, the dune file needs to be as follows:

(executable
 (name main)
 (libraries z3))

and z3 needs to be installed on whichever switch you are running dune from. In my case, one of the switches did not have z3 installed.

0

There are 0 best solutions below