Hi there!
I’m a CS student learning ocaml for the first time and have run into some troubles (that I cant figure out a solution for). I am using dune to structure my ocaml project and am trying to define multiple libraries with public names. Although when I try build the project, I am getting a rather non-descriptive error message (see attachment). Would anyone have a solution to fix this? And if so, are there any additional resources I can read to understand more about how Dune works?
Thanks a lot!
Dune is looking for a package with the name ast
and parsing
which it is not finding probably because you do not have an opam package file for it, see General Concepts — Dune documentation
If this is just for building with dune and not publishing to opam, remove the public_name
and it might fix it. Do you have a dune-project
or files with a .opam
extension in the top level directory? Could you list what files are present or run tree . -l 4
or link to the source on GitHub?
Have a look at the Dune quickstart for what the directory structure should look like and what files you should add. Quickstart — Dune documentation
Its not on github yet but this is the structure of the project. Removing public_name does resolve my issues temporarily, but I’m sure later down the track it may cause some issues.
It should only cause issues if you want to publish an opam package for ast or parsing.
If those libraries are internal to odin
then you could leave them as is or publish them as sub-libraries like (public_name odini.parsing)
or (public_name odin.ast)
. They would then be exposed under the odin.opam
package and you would depend on them as odin.ast
.
If that makes sense.
I think defining their public names as odin.parsing and odin.ast works in my case as they will be used as sub-libraries. I am writing a compiler so all the frontend libraries parsing, ast, and eventually typing should be sub-libraries to the intermediate representation (not yet present) where it brings everything together in an executable.
Thanks for your help!
1 Like