caisar-onnx doesn't build when ocaml-protoc-plugin is vendored
If both caiser and ocaml-protoc-plugin are vendored (e.g. by opam-monorepo) I get an error compiling caiser-onnx with dune:
protoc-gen-ocaml: program not found or is not executable
It's because the executable protoc-gen-ocaml
isn't being compiled as a dependency of the dune rule which invokes it (it's invoked indirectly via the script generate_onnx_interface.sh).
Here's a patch that fixes it for me (it doesn't look like I can clone this repo, otherwise I would have just made a PR):
diff --git a/lib/onnx/dune b/lib/onnx/dune
index 1008baf..ea5bb18 100644
--- a/lib/onnx/dune
+++ b/lib/onnx/dune
@@ -5,7 +5,7 @@
(synopsis "ONNX parser for CAISAR"))
(rule
- (deps onnx_protoc.proto generate_onnx_interface.sh)
+ (deps onnx_protoc.proto generate_onnx_interface.sh %{bin:protoc-gen-ocaml})
(targets onnx_protoc.ml)
(action
(run ./generate_onnx_interface.sh)))