How to dunify project that uses volt

I’m a little confused about the dependencies of the modules involved.

--hello.ml--
let foo = "bar" in
  INFO_MSG "msg %s" foo;
--dune--
(executable
 (name hello)
 (preprocess (action (run camlp4 -I /usr/lib/ocaml/camlp4 -I /home/me/.opam/default/lib/volt -parser o -parser op -printer p bolt_pp.cmo %{input-file})))
 (libraries volt threads dynlink))
$> dune build ./hello.exe
Error: No implementations provided for the following modules:
         Dynlink referenced from /home/me/.opam/default/lib/volt/bolt.cmxa(Bolt)
         Thread referenced from /home/me/.opam/default/lib/volt/boltThread.cmx
         Mutex referenced from /home/me/.opam/default/lib/volt/boltThread.cmx
         Unix referenced from /home/me/.opam/default/lib/volt/bolt.cmxa(Bolt)

Am I doing something wrong?

You need to add --verbose switch to understand does that happen on preprocessing stage or when your ./hello.exe is being linked.
If it happens on preprocessing, you need to add more .cm[oa]'s to your camlp4 executable

Also, camlp4 is quite dead. Maybe you will try to avoid volt?

1 Like

Assuming that the volt library itself doesn’t have a dune file, you will likely need to specify the libraries in dependency order: (libraries threads dynlink volt) (and you probably need to add unix too).
I’m not completely sure that it will be enough to solve your problem, but it’s worth trying.

2 Likes

Unfortunately it’s not my project so I can rewrite it. I tried verbose but it didn’t help. Nevertheless, as vlaviron below suggested, preserving the dependency order helped.

Wow. Thanks a lot. That was it.

1 Like